var checkoutMethodHtml;
$(document).ready(function () {
    var tabId = parseInt($("#tabId").val());
    tabJump(tabId);
    switch (tabId) {
        case 0:
            // patientInformation();//发请求函数
            break;
        case 1:
            orderOperationTc(); //开单操作
            break;
        case 2:
            orderDealListTc(); //开单记录
            break;
        case 3:
            diagnoseTc();       //看诊/回访
            break;
        case 4:
            returnTc();      //回访记录
            break;
        case 5:
            visitRecordsTc();       //就诊记录
            break;
        case 6:
            iconTc();        //影像
            break;
        case 7:
            medicalRecordTc();      //病历
            break;
        case 8:
            chargingRecord();       //收费记录
            break;
        case 9:
            memberTc();          //会员信息
            break;
        default:
            break;
    }
    $("#navBox a").click(function (e) {
        e.preventDefault();
        $(this).tab("show");
        switch (e.target.hash) {
            case '#home':
                // patientInformationTc();  //患者信息
                break;
            case '#deal':
                orderOperationTc(); //开单操作
                break;
            case '#dealList':
                orderDealListTc(); //开单记录
                break;
            case '#diagnoseTc':
                diagnoseTc();       //看诊/回访
                break;
            case '#returnTc':
                returnTc();      //回访记录
                break;
            case '#customerd':
                visitRecordsTc();       //就诊记录
                break;
            case '#icon':
                iconTc();        //影像
                break;
            case '#case':
                medicalRecordTc();      //病历
                break;
            case '#charge':
                chargingRecord();       //收费记录
                break;
            case '#member':
                memberTc();          //会员信息
                break;
            default:
                break;
        }
    });
});

$("#chargingRecord").click(function () {
    chargingRecord();
});
$("#paymentRecords").click(function () {
    paymentRecords();
});
$("#arrearageRecord").click(function () {
    arrearageRecord();
});

//新建预约
subsequent = function (id) {
    var index = layer.open({
        type: 2,
        title: '复诊预约',
        area: ['70%', '95%'],
        fix: true,
        maxmin: true,
        content: Feng.ctxPath + '/doctorLooked/subsequent_info/' + id + '/2'
    });
    this.layerIndex = index;
};

//变更科室
changeTreatmentUnit = function () {
    var treatmentUnit = $("#treatmentUnit").val();
    var customerId = $('#id').val();
    var tc = treatmentUnit + "," + customerId;
    var index = layer.open({
        type: 2,
        title: '变更科室',
        area: ['60%', '50%'],
        fix: true,
        maxmin: true,
        content: Feng.ctxPath + '/consultantTwo/change_treatmentUnit/' + tc
    });
    this.layerIndex = index;
};

//患者信息
function patientInformationTc() {
    $.ajax({
        url: Feng.ctxPath + "/customerDetails/patientInformation",
        type: "post",
        data: {
            "id": document.getElementById("id").value
        },
        success: function (data) {
            document.getElementById("treatmentUnit").value = data.treatmentUnit;
            var headhtml = "" +
                " <span style=\"font-size: 1.5em;font-weight: bolder;\">" + data.customerName + "</span>" +
                " <span>" + data.customerAge + "</span>" +
                " <span>" + data.sex + "</span>" +
                " <span>电话：" + data.customerPhone + "</span>" +
                " <span>病历号：" + data.medicalRecordNumber + "</span>" +
                " <span>当前客户状态：" + data.customerStatus + "</span>" +
                " <span>现场TC：" + data.fieldTc + "</span>" +
                " <span>医生：" + data.doctor + "</span>" +
                " <span style=\"font-size: 1.5em;font-weight: bolder;color: black;\">科室：<span id=\"treatmentUnitHtml\">" + data.treatmentUnit + "</span></span>";
            $("#headCustomer").html(headhtml);
            var html = "<div class=\"home_box\">" +
                "    <div style=\"padding: 5px;overflow: hidden;margin-top: 10px;\">" +
                "        <div class=\"col-sm-12\" style=\"border-bottom: 1px solid #cccccc\"><h4>个人信息</h4></div>" +
                "        <div class=\"col-sm-12\">" +
                "            <ul class=\"ul_flex\">" +
                "                <li>" +
                "                    <ul>" +
                "                        <li><span>姓名：</span>" + data.customerName + "</li>" +
                "                        <li><span>性别：</span>" + data.customerSex + "</li>" +
                "                        <li><span>省份：</span>" + data.province + "</li>" +
                "                        <li><span>城市：</span>" + data.cities + "</li>" +
                "                        <li><span>区域：</span>" + data.region + "</li>" +
                "                        <li><span>地址：</span>" + data.address + "</li>" +
                "                        <li><span>电话：</span>" + data.customerPhone + "</li>" +
                "                        <li><span>电话2：</span>" + data.customerPhone2 + "</li>" +
                "                    </ul>" +
                "                </li>" +
                "                <li>" +
                "                    <ul>" +
                "                        <li><span>病历号：</span>" + data.medicalRecordNumber + "</li>" +
                "                        <li><span>生日：</span>" + data.birthday + "</li>" +
                "                        <li><span>年龄：</span>" + data.customerAge + "</li>" +
                "                        <li><span>职业：</span>" + data.occupation + "</li>" +
                "                        <li><span>状态：</span>" + data.customerStatus + "</li>" +
                "                        <li><span>推荐人：</span>" + data.referee + "</li>" +
                "                        <li><span>推荐人关系：</span>" + data.refereeShip + "</li>" +
                "                    </ul>" +
                "                </li>" +
                "                <li>" +
                "                    <ul>" +
                "                        <li><span>QQ号：</span>" + data.qqNumber + "</li>" +
                "                        <li><span>微信号：</span>" + data.wechatNumber + "</li>" +
                "                        <li><span>身份证：</span>" + data.idCardNo + "</li>" +
                "                        <li><span>婚姻状况：</span>" + data.maritalStatus + "</li>" +
                "                        <li><span>有无小孩：</span>" + data.isHaveChildren + "</li>" +
                "                        <li><span>黄页编号：</span>" + data.yellowNumber + "</li>" +
                "                        <li><span>正畸编号：</span>" + data.orthodonticNumber + "</li>" +
                "                    </ul>" +
                "                </li>" +
                "            </ul>" +
                "        </div>" +
                "    </div>" +
                "    <div style=\"padding: 10px;overflow: hidden;\">" +
                "        <div class=\"col-sm-12\" style=\"border-bottom: 1px solid #cccccc\"><h4>项目信息</h4></div>" +
                "        <div class=\"col-sm-12\">" +
                "            <ul class=\"ul_flex\">" +
                "                <li>" +
                "                    <ul>" +
                "                        <li><span>到店门诊：</span>" + data.arrivalStore + "</li>" +
                "                        <li><span>一级渠道：</span>" + data.oneChannel + "</li>" +
                "                        <li><span>二级渠道：</span>" + data.twoChannel + "</li>" +
                "                        <li><span>三级渠道：</span>" + data.thrChannel + "</li>" +
                "                    </ul>" +
                "                </li>" +
                "                <li>" +
                "                    <ul>" +
                "                        <li><span>初诊TC：</span>" + data.fieldTc + "</li>" +
                "                        <li><span>一级媒介：</span>" + data.oneMedium + "</li>" +
                "                        <li><span>二级媒介：</span>" + data.twoMedium + "</li>" +
                "                        <li><span>三级媒介：</span>" + data.thrMedium + "</li>" +
                "                    </ul>" +
                "                </li>" +
                "                <li>" +
                "                    <ul>" +
                "                        <li><span>首次到店时间：</span>" + data.arrivalTime + "</li>" +
                "                        <li><span>首次咨询项目：</span>" + data.appointmentPayService + "</li>" +
                "                        <li><span>首次建档人：</span>" + data.archiving + "</li>" +
                "                    </ul>" +
                "                </li>" +
                "            </ul>" +
                "        </div>" +
                "    </div>" +
                "    <div>" +
                "        <div class=\"col-sm-12\">" +
                "            <ul style=\"padding-left: 10px;\">" +
                "                <li>" +
                "                    <p>备注</p>" +
                "                    <textarea id=\"remarks\" name=\"remarks\" readOnly=\"readOnly\" rows=\"6\" style=\"width: 75%\">" + data.remarks + "</textarea>" +
                "                </li>" +
                "            </ul>" +
                "        </div>" +
                "    </div>" +
                "</div>";
            $("#home").html(html);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
}

//就诊记录
function visitRecordsTc() {
    $.ajax({
        url: Feng.ctxPath + "/customerDetails/visitRecords",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            var html = " " +
                "<div class=\"home_box\" style=\"padding: 10px 10px 0;\">" +
                "<div style=\"height: 100%;background: white;padding: 12px 20px;\">" +
                "<ul id=" + data[0].id + " name=" + data[0].id + " style=\"width: 600px;\">" +
                "    <div style=\"display: flex;\">" +
                "        <div>" +
                "            <span>按预约状态筛选</span>" +
                "            <span style=\"margin: 0 10px;\"><label><input type=\"checkbox\" checked=\"checked\" id=\"containCancel\">包含取消</label></span>" +
                "            <span><label><input type=\"checkbox\" checked=\"checked\" id=\"breakPromise\" >包含失约</label></span>" +
                "        </div>" +
                "        <div style=\"margin-left: 30px;\">" +
                "            <span>按预约类型筛选</span>" +
                "            <span style=\"margin: 0 10px;\"><label><input type=\"checkbox\" checked=\"checked\" id=\"includingAppointment\">包含预约</label></span>" +
                "            <span><label><input type=\"checkbox\" checked=\"checked\" id=\"includedShop\" >包含到店</label></span>" +
                "        </div>" +
                "    </div>";
            for (var i = 0; i < data.length; i++) {
                if (data[i].status == "到店") {
                    html += "<li class=\"includedShop\" value=\"" + data[i].id + "\" style=\"position: relative;font-weight: bold;color: #666666;\">" +
                        "        <div style=\"display: flex;align-items: center;\">" +
                        "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;\" value=\"" + data[i].startTime + "\">" + data[i].startTimeOne + "</p>" +
                        "            <img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/timeAxis.png\" style=\"width: 35px;\">" +
                        "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;text-indent: 0.4em;\" value=" + data[i].startTime + "> " + data[i].startTimeTwo + "</p>" +
                        "            <div style=\"flex: 1;text-align: right\"></div>" +
                        "        </div>" +
                        "        <div value=" + data[i].startTime + "></div>" +
                        "        <div style=\"margin-left: 116px;border-left: 4px solid #b5b5b5;padding: 7px 0 25px 25px;margin-bottom: 5px;\">" +
                        "            <div style=\"background: #f1f1f1;padding: 10px;\">" +
                        "                <div style=\"margin-bottom: 10px;position: relative\">" +
                        "                    <span style=\"font-size: 16px;\">预约</span>"
                    if (data[i].status == "到店") {
                        html += "<span style=\"background: #42c0d4;color: white;margin-left: 20px;padding: 2px 10px;border-radius: 2px;\">" + data[i].status + "</span>";
                    }
                    if (data[i].status == "预约") {
                        html += "<span style=\"background: #3bc442;color: white;margin-left: 20px;padding: 2px 10px;border-radius: 2px;\">" + data[i].status + "</span>";
                    }
                    html += " <span style=\"margin-left: 50px;\">【" + data[i].arrivalStore + "】</span>" +
                        "                    <span style=\"float: right;padding: 0 10px;border-radius: 2px;background: white;border: 1px solid #dddddd;\">" +
                        "                        <a href=\"javascript:;\" onclick=\"getUpdateLog('" + data[i].id + "')\">日志</a></span>" +
                        "                </div>" +
                        "                <div style=\"letter-spacing: 1px;\">姓名：" + data[i].customerName + "</div>" +
                        "                <div style=\"letter-spacing: 1px;\">医生：" + data[i].doctor + "</div>" +
                        "                <div style=\"letter-spacing: 1px;\">现场TC：" + data[i].fieldTc + "</div>" +
                        "                <div style=\"letter-spacing: 1px;\">项目：" + data[i].appointmentPayService + "</div>" +
                        "                <div style=\"letter-spacing: 1px;\">备注:" + data[i].remarksReservation + "</div>" +
                        "            </div>" +
                        "            <div>" + data[i].archiving + "&nbsp;创建于&nbsp;" + data[i].createAppointmentTime + "</div>" +
                        "        </div>" +
                        "    </li>"
                } else if (data[i].status == "预约") {
                    html += "<li class=\"includingAppointment\" value=\"" + data[i].id + "\" style=\"position: relative;font-weight: bold;color: #666666;\">" +
                        "        <div style=\"display: flex;align-items: center;\">" +
                        "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;\" value=\"" + data[i].startTime + "\">" + data[i].startTimeOne + "</p>" +
                        "            <img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/timeAxis.png\" style=\"width: 35px;\">" +
                        "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;text-indent: 0.4em;\" value=\"" + data[i].startTime + "\">" + data[i].startTimeTwo + "</p>" +
                        "            <div style=\"flex: 1;text-align: right\">";
                    if (data[i].outpatientName == data[i].arrivalStore) {
                        html += "            <button onclick=\"cancelAppointment('" + data[i].id + "')\" class=\"btn\" type=\"button\" style=\"background:#ffffff;color:#666666;border:1px solid #dddddd;padding: 3px 17px;border-radius: 0;\">取消</button>" +
                            "                <button onclick=\"modifyAppointment('" + data[i].id + "')\" class=\"btn\" type=\"button\" style=\"background:#ffffff;color:#666666;border:1px solid #dddddd;padding: 3px 14px;border-radius: 0;\">修改</button>";
                    }
                    html += "  </div>" +
                        "        </div>" +
                        "        <div value=\"" + data[i].startTime + "\"></div>" +
                        "        <div style=\"margin-left: 116px;border-left: 4px solid #b5b5b5;padding: 7px 0 25px 25px;margin-bottom: 5px;\">" +
                        "            <div style=\"background: #f1f1f1;padding: 10px;\">" +
                        "                <div style=\"margin-bottom: 10px;position: relative\">" +
                        "                    <span style=\"font-size: 16px;\">预约</span>";
                    if (data[i].status == "到店") {
                        html += "<span style=\"background: #42c0d4;color: white;margin-left: 20px;padding: 2px 10px;border-radius: 2px;\">" + data[i].status + "</span>";
                    }
                    if (data[i].status == "预约") {
                        html += "<span style=\"background: #3bc442;color: white;margin-left: 20px;padding: 2px 10px;border-radius: 2px;\">" + data[i].status + "</span>";
                    }
                    html += " <span style=\"margin-left: 50px;\">【" + data[i].arrivalStore + "】</span>" +
                        "                    <span style=\"float: right;padding: 0 10px;border-radius: 2px;background: white;border: 1px solid #dddddd;\"><a href=\"javascript:;\" onclick=\"getUpdateLog('" + data[i].id + "')\">日志</a></span>" +
                        "                </div>" +
                        "                <div style=\"letter-spacing: 1px;\">姓名：" + data[i].customerName + "</div>" +
                        "                <div style=\"letter-spacing: 1px;\">医生：" + data[i].doctor + "</div>" +
                        "                <div style=\"letter-spacing: 1px;\">现场TC：" + data[i].fieldTc + "</div>" +
                        "                <div style=\"letter-spacing: 1px;\">项目：" + data[i].appointmentPayService + "</div>" +
                        "                <div style=\"letter-spacing: 1px;\">备注:" + data[i].remarksReservation + "</div>" +
                        "            </div>" +
                        "            <div>" + data[i].archiving + "&nbsp;创建于&nbsp;" + data[i].createAppointmentTime + "</div>" +
                        "        </div>" +
                        "    </li>";
                    if (data[i].arrivalStatus == "8") {
                        html += "<li class=\"containCancel\" value=\"" + data[i].id + "\" style=\"position: relative;font-weight: bold;color: #666666;\">" +
                            "        <div style=\"display: flex;align-items: center;\">" +
                            "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;\" value=\"" + data[i].startTime + "\">" + data[i].startTimeOne + "</p>" +
                            "            <img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/timeAxis.png\" style=\"width: 35px;\">" +
                            "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;text-indent: 0.4em;\" value=\"" + data[i].startTime + "\">" + data[i].startTimeTwo + " </p>" +
                            "            <div style=\"flex: 1;text-align: right\"></div>" +
                            "        </div>" +
                            "        <div value=\"" + data[i].startTime + "\"></div>" +
                            "        <div style=\"margin-left: 116px;border-left: 4px solid #b5b5b5;padding: 7px 0 25px 25px;margin-bottom: 5px;\">" +
                            "            <div style=\"background: #f1f1f1;padding: 10px;\">" +
                            "                <div style=\"margin-bottom: 10px;position: relative\">" +
                            "                    <span style=\"font-size: 16px;\">预约</span>" +
                            "                    <span style=\"background: #3bc442;color: white;margin-left: 20px;padding: 2px 10px;border-radius: 2px;\">预约</span>" +
                            "                    <span style=\"margin-left: 50px;\">【" + data[i].arrivalStore + "】</span>" +
                            "                    <span style=\"color: red;position: absolute;right: 66px;top: 0;\">已取消</span>" +
                            "                    <span style=\"float: right;padding: 0 10px;border-radius: 2px;background: white;border: 1px solid #dddddd;\"><a href=\"javascript:;\" onclick=\"getUpdateLog('" + data[i].id + "')\">日志</a></span>" +
                            "                </div>" +
                            "                <div style=\"letter-spacing: 1px;\">姓名：" + data[i].customerName + "</div>" +
                            "                <div style=\"letter-spacing: 1px;\">医生：" + data[i].doctor + "</div>" +
                            "                <div style=\"letter-spacing: 1px;\">现场TC：" + data[i].fieldTc + "</div>" +
                            "                <div style=\"letter-spacing: 1px;\">项目：" + data[i].appointmentPayService + "</div>" +
                            "                <div style=\"letter-spacing: 1px;\">备注:" + data[i].remarksReservation + "</div>" +
                            "            </div>" +
                            "            <div>" + data[i].archiving + "&nbsp;创建于&nbsp;" + data[i].createAppointmentTime + "</div>" +
                            "        </div>" +
                            "    </li>";
                    } else if (data[i].arrivalStatus == "7") {
                        html += " <li class=\"breakPromise\" value=\"" + data[i].id + "\" style=\"position: relative;font-weight: bold;color: #666666;\">" +
                            "        <div style=\"display: flex;align-items: center;\">" +
                            "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;\" value=\"" + data[i].startTime + "\">" + data[i].startTimeOne + "</p>" +
                            "            <img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/timeAxis.png\" style=\"width: 35px;\">" +
                            "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;text-indent: 0.4em;\" value=\"" + data[i].startTime + "\">" + data[i].startTimeTwo + "</p>" +
                            "            <div style=\"flex: 1;text-align: right\"></div>" +
                            "        </div>" +
                            "        <div value=\"" + data[i].startTime + "\"></div>" +
                            "        <div style=\"margin-left: 116px;border-left: 4px solid #b5b5b5;padding: 7px 0 25px 25px;margin-bottom: 5px;\">" +
                            "            <div style=\"background: #f1f1f1;padding: 10px;\">" +
                            "                <div style=\"margin-bottom: 10px;position: relative\">" +
                            "                    <span style=\"font-size: 16px;\">预约</span>" +
                            "                    <span style=\"background: #3bc442;color: white;margin-left: 20px;padding: 2px 10px;border-radius: 2px;\">预约</span>" +
                            "                    <span style=\"margin-left: 50px;\">【" + data[i].arrivalStore + "】</span>" +
                            "                    <span style=\"color: red;position: absolute;right: 66px;top: 0;\">失约</span>" +
                            "                    <span style=\"float: right;padding: 0 10px;border-radius: 2px;background: white;border: 1px solid #dddddd;\">" +
                            "                        <a href=\"javascript:;\" onclick=\"getUpdateLog('" + data[i].id + "')\">日志</a></span>" +
                            "                </div>" +
                            "                <div style=\"letter-spacing: 1px;\">姓名：" + data[i].customerName + "</div>" +
                            "                <div style=\"letter-spacing: 1px;\">医生：" + data[i].doctor + "</div>" +
                            "                <div style=\"letter-spacing: 1px;\">现场TC：" + data[i].fieldTc + "</div>" +
                            "                <div style=\"letter-spacing: 1px;\">项目：" + data[i].appointmentPayService + "</div>" +
                            "                <div style=\"letter-spacing: 1px;\">备注:" + data[i].remarksReservation + "</div>" +
                            "            </div>" +
                            "            <div>" + data[i].archiving + "&nbsp;创建于&nbsp;" + data[i].createAppointmentTime + "</div>" +
                            "        </div>" +
                            "    </li>"
                    }
                }
                else if (data[i].arrivalStatus == "8") {
                    html +="<li class=\"containCancel includingAppointment\" value=\""+data[i].id+" style=\"position: relative;font-weight: bold;color: #666666;\"> " +
                        "        <div style=\"display: flex;align-items: center;\"> " +
                        "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;\" value=\""+data[i].startTime+"\">"+data[i].startTimeOne+"</p> " +
                        "            <img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/timeAxis.png\" style=\"width: 35px;\"> " +
                        "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;text-indent: 0.4em;\" value=\""+data[i].startTime+"\"> "+data[i].startTimeTwo+"</p> " +
                        "            <div style=\"flex: 1;text-align: right\"></div> " +
                        "        </div> " +
                        "        <div value=\""+data[i].startTime+"\"></div> " +
                        "        <div style=\"margin-left: 116px;border-left: 4px solid #b5b5b5;padding: 7px 0 25px 25px;margin-bottom: 5px;\"> " +
                        "            <div style=\"background: #f1f1f1;padding: 10px;\"> " +
                        "                <div style=\"margin-bottom: 10px;position: relative\"> " +
                        "                    <span style=\"font-size: 16px;\">预约</span> " +
                        "                    <span style=\"background: #3bc442;color: white;margin-left: 20px;padding: 2px 10px;border-radius: 2px;\">预约</span> " +
                        "                    <span style=\"margin-left: 50px;\">【"+data[i].arrivalStore+"】</span> " +
                        "                    <span style=\"color: red;position: absolute;right: 66px;top: 0;\">已取消</span> " +
                        "                    <span style=\"float: right;padding: 0 10px;border-radius: 2px;background: white;border: 1px solid #dddddd;\"><a href=\"javascript:;\" onclick=\"getUpdateLog('"+data[i].id+"')\">日志</a></span> " +
                        "                </div> " +
                        "                <div style=\"letter-spacing: 1px;\">姓名："+data[i].customerName+"</div> " +
                        "                <div style=\"letter-spacing: 1px;\">医生："+data[i].doctor+"</div> " +
                        "                <div style=\"letter-spacing: 1px;\">现场TC："+data[i].fieldTc+"</div> " +
                        "                <div style=\"letter-spacing: 1px;\">项目："+data[i].appointmentPayService+"</div> " +
                        "                <div style=\"letter-spacing: 1px;\">备注:"+data[i].remarks+"</div> " +
                        "            </div> " +
                        "            <div>"+data[i].archiving+"&nbsp;创建于&nbsp;"+data[i].createAppointmentTime+"</div> " +
                        "        </div> " +
                        "    </li>";
                }   else if (data[i].arrivalStatus == "7") {
                    html +="<li class=\"breakPromise includingAppointment\" value=\""+data[i].id+"\" style=\"position: relative;font-weight: bold;color: #666666;\"> " +
                        "        <div style=\"display: flex;align-items: center;\"> " +
                        "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;\" value=\""+data[i].startTime+"\">"+data[i].startTimeOne+"</p> " +
                        "            <img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/timeAxis.png\" style=\"width: 35px;\"> " +
                        "            <p style=\"font-weight: bold;font-size: 16px;margin: 0;width: 100px;text-indent: 0.4em;\" value=\""+data[i].startTime+"\"> "+data[i].startTimeTwo+"</p> " +
                        "            <div style=\"flex: 1;text-align: right\"></div> " +
                        "        </div> " +
                        "        <div value=\""+data[i].startTime+"\"></div> " +
                        "        <div style=\"margin-left: 116px;border-left: 4px solid #b5b5b5;padding: 7px 0 25px 25px;margin-bottom: 5px;\"> " +
                        "            <div style=\"background: #f1f1f1;padding: 10px;\"> " +
                        "                <div style=\"margin-bottom: 10px;position: relative\"> " +
                        "                    <span style=\"font-size: 16px;\">预约</span> " +
                        "                    <span style=\"background: #3bc442;color: white;margin-left: 20px;padding: 2px 10px;border-radius: 2px;\">预约</span> " +
                        "                    <span style=\"margin-left: 50px;\">【"+data[i].arrivalStore+"】</span> " +
                        "                    <span style=\"color: red;position: absolute;right: 66px;top: 0;\">失约</span> " +
                        "                    <span style=\"float: right;padding: 0 10px;border-radius: 2px;background: white;border: 1px solid #dddddd;\"> " +
                        "                        <a href=\"javascript:;\" onclick=\"getUpdateLog('"+data[i].id+"')\">日志</a></span> " +
                        "                </div> " +
                        "                <div style=\"letter-spacing: 1px;\">姓名："+data[i].customerName+"</div> " +
                        "                <div style=\"letter-spacing: 1px;\">医生："+data[i].doctor+"</div> " +
                        "                <div style=\"letter-spacing: 1px;\">现场TC："+data[i].fieldTc+"</div> " +
                        "                <div style=\"letter-spacing: 1px;\">项目："+data[i].appointmentPayService+"</div> " +
                        "                <div style=\"letter-spacing: 1px;\">备注:"+data[i].remarks+"</div> " +
                        "            </div> " +
                        "            <div>"+data[i].archiving+"&nbsp;创建于&nbsp;"+data[i].createAppointmentTime+"</div> " +
                        "        </div> " +
                        "    </li>";
                }
            }
            html += "  <script>" +
                "        $(\"#includingAppointment\").click(function () {" +
                "            if($(\"#includingAppointment\").is(':checked')){" +
                "                $(\".includingAppointment\").show()" +
                "            }else {" +
                "                $(\".includingAppointment\").hide()" +
                "            }" +
                "        });" +
                "        $(\"#includedShop\").click(function () {" +
                "            if($(\"#includedShop\").is(':checked')){" +
                "                $(\".includedShop\").show()" +
                "            }else {" +
                "                $(\".includedShop\").hide()" +
                "            }" +
                "        });" +
                "        $(\"#containCancel\").click(function () {" +
                "            if($(\"#containCancel\").is(':checked')){" +
                "                $(\".containCancel\").show()" +
                "            }else {" +
                "                $(\".containCancel\").hide()" +
                "            }" +
                "        });" +
                "        $(\"#breakPromise\").click(function () {" +
                "            if($(\"#breakPromise\").is(':checked')){" +
                "                $(\".breakPromise\").show()" +
                "            }else {" +
                "                $(\".breakPromise\").hide()" +
                "            }" +
                "        });" +
                "        </script>";
            html += "</ul>" +
                " </div>" +
                " </div>";
            $("#customerd").html(html);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
}

//取消预约
cancelAppointment = function (customerId) {
    $.ajax({
        url: Feng.ctxPath + "/customer/getCustomerIsDealStatus/" + customerId,
        type: "post",
        success: function (data) {
            if (data == 1) {
                alert("此患者已开单不能取消预约！");
                return
            } else if (data == 4) {
                alert("此患者充了储值或积分不能取消预约！");
                return
            } else {
                var index = layer.open({
                    type: 2,
                    title: '取消预约',
                    area: ['30%', '40%'],
                    fix: true,
                    maxmin: true,
                    content: Feng.ctxPath + '/doctorLooked/cancelAppointment/' + customerId
                });
                this.layerIndex = index;
            }
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    })
};

//修改预约
modifyAppointment = function (ids) {
    var index = layer.open({
        type: 2,
        title: '修改预约客户',
        area: ['70%', '95%'],
        fix: true,
        maxmin: true,
        content: Feng.ctxPath + '/consultant/doctor_addTasks/' + ids
    });
    this.layerIndex = index;
};

//就诊记录日志
getUpdateLog = function (customerId) {
    var index = layer.open({
        type: 2,
        title: '改动日志',
        area: ['80%', '80%'], //宽高
        fix: true, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/doctorLooked/getUpdateLog/' + customerId
    });
    this.layerIndex = index;
};

//开单操作
function orderOperationTc() {
    $.ajax({
        url: Feng.ctxPath + "/consultantDetails/orderOperation",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            document.getElementById("moneyBalance").value = data.moneyBalance;
            document.getElementById("jfbalance").value = data.jfbalance;
            document.getElementById("lowestPriceBill").value = data.lowestPriceBill;
            document.getElementById('discountDiscount').value = data.discountDiscount;
            document.getElementById('moneyBalance').innerHTML = data.moneyBalance;
            document.getElementById('jfbalance').innerHTML = data.jfbalance;
            checkoutMethodHtml = data.obtainDeductionMethod;
            var getDepartmentList = '<option value="">--请选科室--</option>';
            for (var i = 0; i < data.getDepartmentList.length; i++) {
                getDepartmentList += '<option value="' + data.getDepartmentList[i].department + '">' + data.getDepartmentList[i].department + '</option>';
            }
            document.getElementById('treatmentUnitTwo').innerHTML = getDepartmentList;
            if ($("#treatmentUnit").val() != "") {
                $("#treatmentUnitTwo option[value='" + $("#treatmentUnit").val() + "']").attr("selected", "selected");
            }
            var getDoctorList = '<option value="">--请选择医生--</option>';
            for (var i = 0; i < data.getDoctorList.length; i++) {
                getDoctorList += '<option value="' + data.getDoctorList[i].doctor + '">' + data.getDoctorList[i].doctor + '</option>';
            }
            document.getElementById('projectDoctor').innerHTML = getDoctorList;
            var getNurseList = '<option value="">--请选择护士--</option>';
            for (var i = 0; i < data.getNurseList.length; i++) {
                getNurseList += '<option value="' + data.getNurseList[i].nurse + '">' + data.getNurseList[i].nurse + '</option>';
            }
            document.getElementById('projectNurse').innerHTML = getNurseList;
            getTreatmentUnit();
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
}

//开单记录
function orderDealListTc() {
    $.ajax({
        url: Feng.ctxPath + "/consultantDetails/orderDealListTc",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            var html = "";
            if (data.length == 0) {
                html = "<div id=\"caseInfoTitle\" style=\"position: absolute;top: 60%;left: 50%;transform: translate(-50%,-50%);\"><div><img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/opening.png\" alt=\"\"></div></div>";
            } else {
                html = "<ul style=\"padding: 0;width: 100%;background:white;\">";
                for (var i = 0; i < data.length; i++) {
                    html += "<div style=\"display: none\">" +
                        "        <p style=\"background-color: palegreen;font-weight: bold;padding-left: 10px\"" +
                        "           value=\"" + data[i].getTime + "\">" + data[i].getTime + "</p>" +
                        "    </div>" +
                        "    <li value=\"" + data[i].customerId + "\" style=\"position: relative;padding:10px 20px;\">" +
                        "        <div style=\"display: flex;align-items: center;\">" +
                        "            <p style=\"font-weight: bold;font-size: 15px;margin: 0;width: 100px;\"" +
                        "               value=\"" + data[i].operationTime + "\">" + data[i].operationTimeOne + "</p>" +
                        "            <img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/timeAxis.png\" style=\"width: 35px;\">" +
                        "            <p style=\"font-weight: bold;font-size: 15px;margin: 0;width: 100px;text-indent: 0.4em;\"" +
                        "               value=\"" + data[i].operationTime + "\">" + data[i].operationTimeTwo + "</p>" +
                        "        </div>" +
                        "        <div style=\"margin-left: 116px;border-left: 4px solid #999999;padding: 7px 0 10px 25px;\">" +
                        "            <div style=\"display: flex;padding: 5px;color: #666a73;border-top: 2px solid #ff7e00;border-bottom: 2px solid #ff7e00;text-align: center\">";
                    if (data[i].isDo == 5) {
                        html += "<span style=\"flex: 1;\">门店</span>" +
                            "                <span style=\"flex: 1;\">状态</span>" +
                            "                <span style=\"flex: 1;\"  class=\"beyond\" title=\"交易状态\">交易状态</span>" +
                            "                <span style=\"flex: 1.5;\">牙位</span>" +
                            "                <span style=\"flex: 2.5;\">项目名称</span>" +
                            "                <span style=\"flex: 1;\">医生</span>" +
                            "                <span style=\"flex: 1;\">护士</span>" +
                            "                <span style=\"flex: 1;\">单价(元)</span>" +
                            "                <span style=\"flex: 1;\">数量</span>" +
                            "                <span style=\"flex: 1;\">单位</span>" +
                            "                <span style=\"flex: 1;\">折扣(%)</span>" +
                            "                <span style=\"flex: 1;\" class=\"beyond\" title=\"折后金额(元)\">折后金额(元)</span>" +
                            "                <span style=\"flex: 1;\" class=\"beyond\" title=\"抵扣方式\">抵扣方式</span>" +
                            "                <span style=\"flex: 1;\" class=\"beyond\" title=\"抵扣金额(元)\">抵扣金额(元)</span>" +
                            "                <span style=\"flex: 1.2;\" class=\"beyond\" title=\"储值划扣金额(元)\">储值划扣金额(元)</span>" +
                            "                <span style=\"flex: 1;\">操作</span>";
                    } else {
                        html += "<span style=\"flex: 1;\">门店</span>" +
                            "                <span style=\"flex: 1;\">状态</span>" +
                            "                <span style=\"flex: 1;\">交易状态</span>" +
                            "                <span style=\"flex: 1.5;\">首次开单时间</span>" +
                            "                <span style=\"flex: 1;\">医生</span>" +
                            "                <span style=\"flex: 1;\">护士</span>" +
                            "                <span style=\"flex: 1;\">TC</span>" +
                            "                <span style=\"flex: 1;\">本次缴费</span>" +
                            "                <span style=\"flex: 2;\">备注</span>" +
                            "                <span style=\"flex: 1;\">操作人</span>";
                    }
                    html += "</div>";
                    var mendian = $("#outpatientNameValue").val();
                    var serviceActualPay2 = 0.00;
                    var serviceActualPay1 = 0.00;
                    var foldingPay2 = 0.00;
                    var accountArrears2 = 0.00;
                    var primaryAmount2 = 0.00;
                    var serviceActualPays = 0.00;
                    var depositAmounts = 0.00;
                    var s1 = '';
                    var s2 = '';
                    var ss = "";
                    var huanqiankuan = "";
                    var deletediv = "";
                    var doctors = "";
                    var sp = '<div style="position: absolute;top: 20px;right: 20px;">' +
                        '<a href="javascript:;" style="color: #FF7E00" onclick=\'singlePrint("' + data[i].dealList[data[i].dealList.length - 1].customerId + '","' + data[i].dealList[data[i].dealList.length - 1].reservationsId + '","' + data[i].dealList[data[i].dealList.length - 1].getTime + '","' + data[i].dealList[data[i].dealList.length - 1].operationTime + '","' + data[i].dealList[data[i].dealList.length - 1].outpatientName + '")\'>打印确认单</a>' +
                        '</div>';
                    for (var j = 0; j < data[i].dealList.length; j++) {
                        serviceActualPay2 += parseFloat(data[i].dealList[j].serviceActualPay) + parseFloat(data[i].dealList[j].depositAmount);
                        serviceActualPay1 += parseFloat(data[i].dealList[j].serviceActualPay);
                        primaryAmount2 += parseFloat(data[i].dealList[j].payService * data[i].dealList[j].payServiceNum);
                        foldingPay2 += parseFloat(data[i].dealList[j].foldingPay);
                        accountArrears2 += parseFloat(data[i].dealList[j].accountArrears);
                        depositAmounts += parseFloat(data[i].dealList[j].depositAmount);
                        if (document.getElementById("roleNameLogin").value.indexOf("客服主管") ||
                            document.getElementById("roleNameLogin").value.indexOf("管理员")) {
                            if ((data[i].dealList[data[i].dealList.length - 1].dealStatus) == "已结账") {
                                deletediv = '<a href="javascript:;" style="color: #da6792;" onclick=\'deleteDealInfos("' + data[i].dealList[j].id2 + '")\'>删除</a>';
                            }
                        }
                        ss += '<div style="display: flex;padding: 5px;border-bottom: 2px solid #f5f5f5;text-align: center">' +
                            '<span style="flex: 1;" class="beyond">' + data[i].dealList[data[i].dealList.length - 1].outpatientName + '</span>' +
                            '<span style="flex: 1;" class="beyond">' + data[i].dealList[j].dealStatus + '</span>' +
                            '<span style="flex: 1;">' + data[i].dealList[j].isDoName + '</span>' +
                            '<div style="display: flex;flex-direction: column;flex: 1.5;height: 28px;"><div style="flex: 1;display: flex;border-bottom: 1px solid #999999"><div style="flex: 1;border-right: 1px solid #999999;line-height: 14px;">' + data[i].dealList[j].leftUp + '</div><div style="flex: 1;line-height: 14px;">' + data[i].dealList[j].rightUp + '</div></div><div style="flex: 1;display: flex"><div style="flex: 1;border-right: 1px solid #999999;line-height: 14px;">' + data[i].dealList[j].leftDown + '</div><div style="flex: 1;line-height: 14px;">' + data[i].dealList[j].rightDown + '</div></div></div>' +
                            '<span style="flex: 2.5;" class="beyond" title="' + data[i].dealList[j].payServiceName + '">' + data[i].dealList[j].payServiceName + '</span>' +
                            '<span style="flex: 1;" class="beyond" title="' + data[i].dealList[j].doctor + '">' + data[i].dealList[j].doctor + '</span>' +
                            '<span style="flex: 1;" class="beyond" title="' + data[i].dealList[j].nurse + '">' + data[i].dealList[j].nurse + '</span>' +
                            '<span style="flex: 1;">' + data[i].dealList[j].payService + '</span>' +
                            '<span style="flex: 1;">' + data[i].dealList[j].payServiceNum + '</span>' +
                            '<span style="flex: 1;">' + data[i].dealList[j].unit + '</span>' +
                            '<span style="flex: 1;">' + data[i].dealList[j].orderDiscount + '</span>' +
                            '<span style="flex: 1;">' + (data[i].dealList[j].foldingPay).toFixed(2) + '</span>' +
                            '<span style="flex: 1;">' + data[i].dealList[j].deductionTypeName + '</span>' +
                            '<span style="flex: 1;">' + data[i].dealList[j].deductionAmount + '</span>' +
                            '<span style="flex: 1.2;">' + data[i].dealList[j].depositAmount + '</span>' +
                            '<span style="flex: 1;">' + data[i].dealList[j].tcName + '</span></div>';
                        serviceActualPays += data[i].dealList[j].serviceActualPay;
                    }
                    huanqiankuan = '<div style="display: flex;padding: 5px;border-bottom: 2px solid #f5f5f5;text-align: center">' +
                        '<span style="flex: 1;" class="beyond">' + data[i].dealList[data[i].dealList.length - 1].outpatientName + '</span>' +
                        '<span style="flex: 1;" class="beyond">' + data[i].dealList[data[i].dealList.length - 1].dealStatus + '</span>' +
                        '<span style="flex: 1;">' + data[i].dealList[data[i].dealList.length - 1].isDoName + '</span>' +
                        '<span style="flex: 1.5;">' + data[i].dealList[data[i].dealList.length - 1].operationTime + '</span>' +
                        '<span style="flex: 1;">' + data[i].dealList[data[i].dealList.length - 1].doctor + '</span>' +
                        '<span style="flex: 1;">' + data[i].dealList[data[i].dealList.length - 1].nurse + '</span>' +
                        '<span style="flex: 1;">' + data[i].dealList[data[i].dealList.length - 1].fieldTc + '</span>' +
                        '<span style="flex: 1;">' + (serviceActualPays + depositAmounts).toFixed(2) + '</span>' +
                        '<span style="flex: 2;">' + data[i].dealList[data[i].dealList.length - 1].remarks + '</span>' +
                        '<span style="flex: 1;">' + data[i].dealList[data[i].dealList.length - 1].tcName + '</span>' +
                        '</div>';
                    doctors += '<div style="border-top: 2px solid #ff7e00;border-bottom: 1px solid #e2e2e2;display: flex">' +
                        '<div style="background: #f1f1f1;flex: 3;padding: 5px;"><div><span>整体折扣：</span><span>' + data[i].dealList[data[i].dealList.length - 1].wholeDiscount + '%</span></div><span>备注：</span>' + data[i].dealList[data[i].dealList.length - 1].remarks + '</div>' +
                        '<div style="flex: 1;padding: 5px 0 5px 10px;display: flex"><div style="flex: 1;padding-right: 10px;">' +
                        '<div style="display: flex"><span style="flex: 1">本单原价</span><span>' + (primaryAmount2).toFixed(2) + '元</span></div>' +
                        '<div style="display: flex"><span style="flex: 1">本单实收</span><span>' + (serviceActualPay2).toFixed(2) + '元</span></div>' +
                        '</div>' +
                        '<div style="flex: 1;"><div style="display: flex"><span style="flex: 1">本单费用</span><span>' + foldingPay2.toFixed(2) + '元</span></div>' +
                        '<div style="display: flex"><span style="flex: 1">本单缴费</span><span>' + serviceActualPay1.toFixed(2) + '元</span></div>' +
                        '<div style="display: flex"><span style="flex: 1">欠费</span><span>' + accountArrears2.toFixed(2) + '元</span></div></div></div></div>';
                    s1 += '<div style="position: absolute;top: 20px;right: 20px;">' +
                        '<a href="javascript:;" style="margin-right: 10px;color: #FF7E00" onclick=\'reDeal("' + data[i].dealList[data[i].dealList.length - 1].customerId + '","' + data[i].dealList[data[i].dealList.length - 1].reservationsId + '","' + data[i].dealList[data[i].dealList.length - 1].operationTime + '","' + data[i].dealList[data[i].dealList.length - 1].getTime + '","' + data[i].dealList[data[i].dealList.length - 1].department + '")\'>重开此单</a>' +
                        '<a href="javascript:;" style="margin-right: 10px;color: #FF7E00" onclick=\'updateOrder("' + data[i].dealList[data[i].dealList.length - 1].customerId + '","' + data[i].dealList[data[i].dealList.length - 1].reservationsId + '","' + data[i].dealList[data[i].dealList.length - 1].operationTime + '","' + data[i].dealList[data[i].dealList.length - 1].getTime + '")\'>修改项目</a>' +
                        '<a href="javascript:;" style="margin-right: 10px;color: #FF7E00" onclick=\'deleteOrder("' + data[i].dealList[data[i].dealList.length - 1].customerId + '","' + data[i].dealList[data[i].dealList.length - 1].reservationsId + '","' + data[i].dealList[data[i].dealList.length - 1].operationTime + '","' + data[i].dealList[data[i].dealList.length - 1].getTime + '")\'>删除</a>' +
                        '<a href="javascript:;" style="color: #FF7E00" onclick=\'singlePrint("' + data[i].dealList[data[i].dealList.length - 1].customerId + '","' + data[i].dealList[data[i].dealList.length - 1].reservationsId + '","' + data[i].dealList[data[i].dealList.length - 1].getTime + '","' + data[i].dealList[data[i].dealList.length - 1].operationTime + '","' + data[i].dealList[data[i].dealList.length - 1].outpatientName + '")\'>打印确认单</a>' +
                        '</div>';
                    s2 += '<div style="position: absolute;top: 20px;right: 20px;">' +
                        '<a href="javascript:;" style="margin-right: 10px;color: #FF7E00" onclick=\'deleteOrder("' + data[i].dealList[data[i].dealList.length - 1].customerId + '","' + data[i].dealList[data[i].dealList.length - 1].reservationsId + '","' + data[i].dealList[data[i].dealList.length - 1].operationTime + '","' + data[i].dealList[data[i].dealList.length - 1].getTime + '")\'>删除</a>' +
                        '<a href="javascript:;" style="color: #FF7E00" onclick=\'singlePrint("' + data[i].dealList[data[i].dealList.length - 1].customerId + '","' + data[i].dealList[data[i].dealList.length - 1].reservationsId + '","' + data[i].dealList[data[i].dealList.length - 1].getTime + '","' + data[i].dealList[data[i].dealList.length - 1].operationTime + '","' + data[i].dealList[data[i].dealList.length - 1].outpatientName + '")\'>打印确认单</a>' +
                        '</div>';
                    if ((data[i].dealList[data[i].dealList.length - 1].dealStatus) == "已开单" && (data[i].dealList[data[i].dealList.length - 1].reservationsId) == $("#reservationsId").val()) {
                        if (data[i].dealList[data[i].dealList.length - 1].outpatientName != mendian) {
                            if (data[i].dealList[data[i].dealList.length - 1].isDoName == "消费") {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    sp + ss + doctors +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            } else {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    sp + huanqiankuan +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            }
                        } else {
                            if (data[i].dealList[data[i].dealList.length - 1].isDoName == "消费") {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    s1 + ss + doctors +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            } else {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    s2 + huanqiankuan +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            }
                        }
                    } else if ((data[i].dealList[data[i].dealList.length - 1].dealStatus) == "待审核" && (data[i].dealList[data[i].dealList.length - 1].reservationsId) == $("#reservationsId").val()) {
                        if (data[i].dealList[data[i].dealList.length - 1].outpatientName != mendian) {
                            if (data[i].dealList[data[i].dealList.length - 1].isDoName == "消费") {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    sp + ss + doctors +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            } else {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    sp + huanqiankuan +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            }
                        } else {
                            if (data[i].dealList[data[i].dealList.length - 1].isDoName == "消费") {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    s1 + ss + doctors +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            } else {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    s2 + huanqiankuan +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            }
                        }
                    } else if ((data[i].dealList[data[i].dealList.length - 1].dealStatus) == "已结账" && (data[i].dealList[data[i].dealList.length - 1].reservationsId) == $("#reservationsId").val()) {
                        if (data[i].dealList[data[i].dealList.length - 1].outpatientName != mendian) {
                            if (data[i].dealList[data[i].dealList.length - 1].isDoName == "消费") {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    sp + ss + doctors +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            } else {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    huanqiankuan +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            }
                        } else {
                            if (data[i].dealList[data[i].dealList.length - 1].isDoName == "消费") {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    sp + ss + doctors +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            } else {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    sp + huanqiankuan +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            }
                        }
                    } else if ((data[i].dealList[data[i].dealList.length - 1].dealStatus) == "审核未通过" && (data[i].dealList[data[i].dealList.length - 1].reservationsId) == $("#reservationsId").val()) {
                        if (data[i].dealList[data[i].dealList.length - 1].outpatientName != mendian) {
                            if (data[i].dealList[data[i].dealList.length - 1].isDoName == "消费") {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    ss + doctors +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            } else {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    huanqiankuan +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            }
                        } else {
                            if (data[i].dealList[data[i].dealList.length - 1].isDoName == "消费") {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    ss + doctors +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            } else {
                                html += "<div value=\"" + data[i].operationTime + "\">" +
                                    huanqiankuan +
                                    "</div>" +
                                    "        </div>" +
                                    "    </li>";
                            }
                        }
                    }
                }
                html += "</ul>";
            }
            $("#orderDealListTc").html(html);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    })
}

function payServiceSearch() {
    var reach = $("#payServiceNames").val().trim();
    var treatmentUnit = $("#treatmentUnitTwo").val();
    var reservationsId = $("#reservationsId").val();
    if (reach != "") {
        $.ajax({
            url: Feng.ctxPath + "/payService/payServiceSearch",
            type: "post",
            data: {
                reach: reach,
                treatmentUnit: treatmentUnit,
                reservationsId: reservationsId
            },
            success: function (data) {
                var patient = "";
                for (var i = 0; i < data.length; i++) {
                    patient += '<li style="padding: 5px 0 10px 10px;border-bottom: 1px solid #cccccc" id="' + data[i].id + '" class="' + data[i].id + '">' +
                        '<div><span>' + data[i].firstLevelProject + '</span>&nbsp;&nbsp;<span>' + data[i].payServiceName + '</span>' +
                        '<span>' + data[i].payServicePriceTwo + '</span>元<input class="department" type="hidden" value="' + data[i].department + '"></div>' +
                        '</li>'
                }
                $("#dataUl").html(patient).show();
            },
            error: function (data) {
                alert('没有权限，请联系系统管理员!');
                parent.layer.close(parent.layer.getFrameIndex(window.name));
            }
        })
    } else {
        $("#dataUl").hide();
    }
}

//看诊/回访
function diagnoseTc() {
    $.ajax({
        url: Feng.ctxPath + "/consultantDetails/diagnoseTc",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            var html = " " +
                " <div class=\"home_box\" style=\"padding: 10px 15px;\">" +
                "    <div class=\"consult\">" +
                "        <div style=\"padding-left: 10px;\">" +
                "            <div><img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/empty.png\" style=\"width: 23px;vertical-align: bottom;\">" +
                "                <h3>看诊记录</h3></div>" +
                "            <div style=\"color: #97c82b;position: absolute;right: 15px;top: 10px;\" class=\"showBox\"> </div>" +
                "<ul style=\"padding: 0 26px;\">";
            //看诊记录
            var reg = new RegExp("& lt;br/& gt;", "g");
            for (var i = 0; i < data.consultantInfoList.length; i++) {
                var diagnosisContent = data.consultantInfoList[i].diagnosisContent.replace(reg, "");
                html += "" +
                    "<li style=\"color: #666666;\">" +
                    " <div style=\"line-height: 18px;\">" +
                    "  <div><span>" + data.consultantInfoList[i].diagnosisTime + "</span></div>" +
                    "  <div><span>现场TC：" + data.consultantInfoList[i].tcName + "&nbsp;&nbsp;详情：" + diagnosisContent + "</span></div>" +
                    " </div>" +
                    "</li>";
            }
            html += " </ul>" +
                "        </div>" +
                "        <div  style=\"box-shadow: rgb(102, 102, 102) 0 0 5px\">" +
                "            <div class=\"hideBoxs\" id=\"jzRecord\">" +
                "                <div>请添加新的看诊记录</div>" +
                "                <div style=\"margin-top: 5px;\">" +
                "                    <textarea name=\"diagnosisContent\" id=\"diagnosisContent\" placeholder=\"可填写顾客主诉、检查发现、是否面诊、设计方案、是否成交、可开发的、未成交原因等\" style=\"width: 100%;height: 80px;padding-left: 5px;\"></textarea>" +
                "                </div>" +
                "                <div style=\"padding: 10px 0;\">" +
                "                    <button type=\"button\" class=\"btn\" onclick=\"ConsultantInfoDlg.addDiagnosisContent()\" style=\"background: #FF7E00;color: white\">确定</button>" +
                "                </div>" +
                "            </div>" +
                "        </div>" +
                "    </div>" +
                "    <div class=\"returnVisit\" style=\"margin-top: 25px;\">" +
                "        <div style=\"padding-left: 10px;\">" +
                "            <div><img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/export.png\" style=\"width: 23px;vertical-align: bottom;\"><h3>回访详情</h3></div>" +
                "            <div style=\"color: #2c9ae9;position: absolute;right: 15px;top: 10px;\" class=\"showBox\"> </div>" +
                "            <div id=\"further\" style=\"padding-left: 26px;\"></div>" +
                "            <div style=\"padding-left: 26px;\">";

            //市场回访记录
            html += " "+data.reservationsInfo.huifang ;
            //回访记录
            for (var i = 0; i < data.tcRevisitsInfoList.length; i++) {
                html += "  " +
                    "  <div>" +
                    "     <div>" +
                    "       <span>" +
                    "         " + data.tcRevisitsInfoList[i].createTime + "&nbsp;&nbsp;" +
                    "         回访人：" + data.tcRevisitsInfoList[i].revisit + "&nbsp;&nbsp;" +
                    "         状态：" + data.tcRevisitsInfoList[i].revisitStatusName + "&nbsp;&nbsp;" +
                    "         内容：" + data.tcRevisitsInfoList[i].remarks + "&nbsp;&nbsp;" +
                    "         结果：" + data.tcRevisitsInfoList[i].revisitContent + "" +
                    "       </span>" +
                    "     </div>" +
                    "  </div>" +
                    " ";
            }
            html += "</div>" +
                "        </div>" +
                "        <div style=\"box-shadow: rgb(102, 102, 102) 0 0 5px\">" +
                "            <div class=\"hideBoxs\">" +
                "                <div class=\"condition\">" +
                "                    <span>计划回访时间<span class=\"asterisk\">*</span></span>" +
                "                    <input id=\"revisitTime\" class=\"input_style\" autocomplete=\"off\" type=\"text\" onclick=\"laydate({istiem:true,format:'YYYY-MM-DD',choose:checkDates})\">" +
                "                </div>" +
                "                <div class=\"condition\">" +
                "                    <span>跟踪状态<span class=\"asterisk\">*</span></span>" +
                "                    <select id=\"followStatus\" name=\"followStatus\" class=\"input_style\">" +
                "                        <option value=\"\">请选择</option>" +
                "                        <option value=\"跟踪中\">跟踪中</option>" +
                "                        <option value=\"跟踪完成\">跟踪完成</option>" +
                "                        <option value=\"跟踪结束\">跟踪结束</option>" +
                "                    </select>" +
                "                </div>" +
                "                <div class=\"condition\">" +
                "                    <span>消费状态<span class=\"asterisk\">*</span></span>" +
                "                    <select id=\"consumptionStatus\" name=\"consumptionStatus\" class=\"input_style\">" +
                "                        <option value=\"\">请选择</option>" +
                "                        <option value=\"未消费\">未消费</option>" +
                "                        <option value=\"只交储值\">只交储值</option>" +
                "                        <option value=\"未完成\">未完成</option>" +
                "                        <option value=\"完成\">完成</option>" +
                "                    </select>" +
                "                </div>" +
                "                <div class=\"condition\">" +
                "                    <span>回访人员<span class=\"asterisk\">*</span></span>" +
                "                    <select id=\"revisit\" name=\"revisit\" class=\"input_style\">" +
                "                    </select>" +
                "                </div>" +
                "                <div class=\"condition\">" +
                "                    <span style=\"vertical-align: top;\">内容模板</span>" +
                "                    <div class=\"btn-group\" style=\"position: relative\">" +
                "                        <button type=\"button\" class=\"btn\" onclick=\"addsf()\" style=\"position: absolute;left: 100px;top: 0;background: white;border: none\">添加模板</button>" +
                "                        <button class=\"btn btn-default dropdown-toggle\" type=\"button\" id=\"dropdownMenu2\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">内容模板<span class=\"caret\"></span></button>" +
                "                        <ul class=\"dropdown-menu\" aria-labelledby=\"dropdownMenu2\" style=\"left: 0;\" id=\"dropdownMenu2Ul\"></ul>" +
                "                    </div>" +
                "                </div>" +
                "                <div class=\"condition\">" +
                "                    <span style=\"vertical-align: top;\">回访计划<span class=\"asterisk\">*</span></span>" +
                "                    <textarea id=\"remarks2\" name=\"remarks2\" style=\"height: 60px;width: 60%;padding: 0 5px;\"></textarea>" +
                "                </div>" +
                "                <div class=\"condition\">" +
                "                    <span style=\"vertical-align: top;\">结果模板</span>" +
                "                    <div class=\"btn-group\" style=\"position: relative\">" +
                "                        <button type=\"button\" class=\"btn\" onclick=\"addjg()\" style=\"position: absolute;left: 100px;top: 0;background: white;border: none\">添加模板</button>" +
                "                        <button class=\"btn btn-default dropdown-toggle\" type=\"button\" id=\"dropdownMenu1\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">结果模板<span class=\"caret\"></span></button>" +
                "                        <ul class=\"dropdown-menu\" aria-labelledby=\"dropdownMenu1\" style=\"left: 0;\" id=\"dropdownMenu1Ul\"></ul>" +
                "                    </div>" +
                "                </div>" +
                "                <div class=\"condition\">" +
                "                    <span style=\"vertical-align: top;\">回访结果</span>" +
                "                    <textarea id=\"revisitContent\" name=\"revisitContent\" style=\"height: 60px;width: 60%;padding: 0 5px;\"></textarea>" +
                "                </div>" +
                "                <div style=\"padding: 10px 0;\">" +
                "                    <button type=\"button\" id='submitTc1' onclick='submitTc1()' class=\"btn\" style=\"background: #FF7E00;color: white\">保存待计划</button>" +
                "                    <button type=\"button\" id='submitTc2' onclick='submitTc2()' class=\"btn\" style=\"background: #FF7E00;color: white\">完成回访</button>" +
                "                </div>" +
                "            </div>" +
                "        </div>" +
                "    </div>" +
                "</div>";
            $("#diagnoseTc").html(html);
            var getTcList = '<option value="">请选择</option>';
            for (var i = 0; i < data.getTcList.length; i++) {
                getTcList += '<option value="' + data.getTcList[i].tcName + '">' + data.getTcList[i].tcName + '</option>';
            }
            document.getElementById('revisit').innerHTML = getTcList;
            var revisitValue = $('#userName').val();
            if (revisitValue != "") {
                $("#revisit option[value='" + revisitValue + "']").attr("selected", "selected");
            }
            var getSfList = "";
            for (var i = 0; i < data.getSfList.length; i++) {
                getSfList += '<li id="' + data.getSfList[i].id + '" style="position: relative"><a href="javascript:;">' + data.getSfList[i].title + '</a><span class="glyphicon glyphicon-remove" style="position: absolute;top: 50%;right: 10px;transform: translateY(-50%)"></span></li>'
            }
            $("#dropdownMenu2Ul").html(getSfList)
            var getJgList = "";
            for (var i = 0; i < data.getJgList.length; i++) {
                getJgList += '<li id="' + data.getJgList[i].id + '" style="position: relative"><a href="javascript:;">' + data.getJgList[i].title + '</a><span class="glyphicon glyphicon-remove" style="position: absolute;top: 50%;right: 10px;transform: translateY(-50%)"></span></li>'
            }
            $("#dropdownMenu1Ul").html(getJgList);

            $("#dropdownMenu2Ul").on('click', 'li', function () {
                var value = $(this).attr('id');
                $.ajax({
                    url: Feng.ctxPath + "/tcRevisit/getSfById",
                    type: "post",
                    data: {
                        id: value
                    },
                    success: function (data) {
                        $("#remarks2").val(data.remarks);
                        $("#remarks").val(data.remarks);
                    },
                    error: function (data) {
                        alert('没有权限，请联系管理员!');
                    }
                });
            });

            $("#dropdownMenu1Ul").on('click', 'li', function () {
                var value = $(this).attr('id');
                $.ajax({
                    url: Feng.ctxPath + "/tcRevisit/getJgById",
                    type: "post",
                    data: {
                        id: value
                    },
                    success: function (data) {
                        $("#revisitContent").val(data.remarks);
                    },
                    error: function (data) {
                        alert('没有权限，请联系管理员!');
                    }
                });
            });

            $("#dropdownMenu2Ul").on('click', '.glyphicon-remove', function (e) {
                e.stopPropagation();
                var value = $(this).parent().attr('id');
                if (confirm("是否删除此模板？")) {
                    $.ajax({
                        url: Feng.ctxPath + "/tcRevisit/deleteSfById",
                        type: "post",
                        data: {
                            id: value
                        },
                        success: function (data) {
                            Feng.success("删除成功!");
                            window.location.reload();
                        },
                        error: function (data) {
                        }
                    });
                }
            });

            $("#dropdownMenu1Ul").on('click', '.glyphicon-remove', function (e) {
                e.stopPropagation();
                var value = $(this).parent().attr('id');
                if (confirm("是否删除此模板？")) {
                    $.ajax({
                        url: Feng.ctxPath + "/tcRevisit/deleteJgById",
                        type: "post",
                        data: {
                            id: value
                        },
                        success: function (data) {
                            Feng.success("删除成功!");
                            window.location.reload();
                        },
                        error: function (data) {
                        }
                    });
                }
            });
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });

}

//回访记录
function returnTc() {
    var defaultColunms = TcFollowTableList.initColumn();
    var reservationsId = $("#reservationsId").val();
    var table = new BSTable(TcFollowTableList.id, "/tcRevisit/TcFollowTableList/" + reservationsId, defaultColunms);
    table.setPaginationType("client");//客户端分页
    TcFollowTableList.table = table.init();
    TcFollowTableList.search();
    $('#TcFollowTableList').bootstrapTable('resetView', {height: $(window).height() - 195});
}

//影像
function iconTc() {
    var html = " " +
        "<style>.ulFlex{display:flex}.ulFlex>li{flex:1;height:90px;border:1px solid #cccccc;text-align:center;line-height:86px;margin-right:15px;}.actives{background:#337ab7;color:white}.ulFlex>li:last-of-type:hover{box-shadow: 0 0 1px 1px #56adf0;  border:1px solid #56adf0;color: #337ab7;cursor: pointer}</style>" +
        "<div class=\"home_box\" id=\"customerInfoForm\">" +
        "    <div style=\"padding: 10px;\">" +
        "        <div style=\"width: 75%\">" +
        "            <ul class=\"ulFlex\">" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">所有类型</li>" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">全景</li>" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">小牙片</li>" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">CBCT</li>" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">照片</li>" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">其他</li>" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">头侧</li>" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">知情同意书</li>" +
        "                <li class=\"flexLi\" onclick=\"uploadAdd(this)\">正畸转诊单</li>" +
        "                <li style=\"color: #347ab7;flex: 2\" onclick=\"openIconType()\"><span class=\"glyphicon glyphicon-cloud-upload\"></span>上传影像</li>" +
        "            </ul>" +
        "        </div>" +
        "        <div><div class=\"col-sm-11\" id=\"contentBoxs\"></div></div>" +
        "    </div>" +
        "</div>";
    $("#icon").html(html);

    $("li.flexLi").click(function () {
        $("li.flexLi").removeClass("actives");
        $(this).addClass("actives");
    });
    $("ul.ulFlex>li").eq(0).click();

}

function openIconType() {//打开上传影像
    var reservationsId = document.getElementById("reservationsId").value;
    var customerId = document.getElementById("customerId").value;
    var cri = reservationsId + "," + customerId;
    var index = layer.open({
        type: 2,
        title: '请关联预约',
        area: ['50%', '50%'], //宽高
        fix: true, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/doctorLooked/openIconType1/' + cri
    });
    this.layerIndex = index;
}

//点击加载影像
function uploadAdd(types) {
    var reservationsId = document.getElementById("reservationsId").value;
    var customerId = document.getElementById("customerId").value;
    var iconType = types.innerHTML;
    var cri = customerId + "," + reservationsId + "," + iconType;
    $.ajax({
        type: "POST",
        url: Feng.ctxPath + "/doctorLooked/getIconInfo/" + cri,
        data: {},
        dataType: "json",
        success: function (data) {
            $("#contentBoxs").html("");
            var obj = {};
            for (var i = 0; i < data.length; i++) {
                if (obj.hasOwnProperty(data[i].iconName)) {
                    obj[data[i].iconName].push(data[i]);
                } else {
                    obj[data[i].iconName] = [];
                    obj[data[i].iconName].push(data[i]);
                }
            }
            for (var item in obj) {
                var timecontainer = $("<div id='" + obj[item][0].diagnoseTime + "' style='box-shadow: 0 0 5px #aaaaaa;margin-top: 20px;padding: 0 0 20px;border-radius: 5px;margin-bottom: 10px;'>" +
                    "<p style='background: #337ab7;color: white;text-indent: 1em;line-height: 40px;'><span>" + obj[item][0].iconName + "</span></p></div>");
                $("#contentBoxs").append(timecontainer);
                for (var w = 0; w < obj[item].length; w++) {
                    var img = $(" " +
                        "<span style='display:inline-block;width: 300px;border: 1px solid #cccccc;margin-left: 20px;position: relative;text-align: center;margin-bottom: 5px;'>" +
                        "<a style='width: 150px;margin:0 auto;' href='javascript:;' class='thumbnail'>" +
                        "<img style='margin: 0;width: 100%;' class='layui-upload-img imagePath' src='" + obj[item][w].imageUrl + "' alt=''></a>" +
                        "<span>" + (obj[item][w].diagnoseTime).substring(0, 10) + "</span>" +
                        "<div>" + (obj[item][w].addName) + "上传于" + (obj[item][w].addTime).substring(0, 10) + "</div>" +
                        "</span>");
                    timecontainer.append(img);
                }
            }
        }
    });
}

//病历
function medicalRecordTc() {
    $.ajax({
        url: Feng.ctxPath + "/customerDetails/medicalRecord",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            var html = "";
            if (data.length == 0) {
                html = "<div id=\"caseInfoTitle\" style=\"position: absolute;top: 60%;left: 50%;transform: translate(-50%,-50%);\"><div><img src=\"https://pynnn.oss-cn-hangzhou.aliyuncs.com/noRecord.png\" alt=\"\"></div></div>";
            } else {
                html = "<div class=\"home_box\" style=\"padding-top: 10px;\">" +
                    "    <div style=\"display: none\">" +
                    "        <button type=\"button\" class=\"btn\" id=\"cancel\" onclick=\"CaseTableList.close()\" style=\"background: #999999\">取消</button>" +
                    "    </div>" +
                    "    <div>" +
                    "        <div id=\"caseInfoTitle\" style=\"position: absolute;top: 60%;left: 50%;transform: translate(-50%,-50%);\"></div>" +
                    "        <div id=\"accordion\" style=\"font-size: 14px;\">" +
                    "            <div class=\"col-sm-12\">";
                for (var i = 0; i < data.length; i++) {
                    if (data[i].type == 1) {
                        html += "<div style=\"margin-bottom: 20px;\">" +
                            "                    <div class=\"fold\" style=\"display: flex;border: 1px solid #dddddd;\">" +
                            "                        <div style=\"flex: 1.2;text-align: center\">" +
                            "                            <div style=\"padding: 5px  15px;\">" +
                            "                                <span style=\"color: #00A8CB;\">" + data[i].finnallyTime1 + "</span>" +
                            "                            </div>" +
                            "                            <div class=\"doctorHide\" style=\"padding: 5px  15px;border-top: 1px solid #dddddd\"></div>" +
                            "                        </div>" +
                            "                        <div style=\"flex: 6;border-right: 1px solid #dddddd;border-left: 1px solid #dddddd;\">" +
                            "                            <div style=\"padding: 5px  15px;border-bottom: 1px solid #dddddd;background: #ebfaff;position: relative\">" +
                            "                                <span>" +
                            "                                    <span>初诊病历</span>" +
                            "                                    <span>|</span><span>诊断：</span>";
                        for (var k = 0; k < data[i].toothSite3List.length; k++) {
                            html += " <span class=\"textHide\">" + data[i].toothSite3List[k].remarks + "</span>";
                        }
                        html += "  <span>|</span><span>治疗：</span>";
                        for (var l = 0; l < data[i].toothSite4List.length; l++) {
                            html += " <span class=\"textHide\">" + data[i].toothSite4List[l].remarks + "</span>";
                        }
                        html += " </span>" +
                            "                                <span style=\"width: 60px;color: #00A8CB;cursor:pointer;position: absolute;right: 0;\" class=\"details\">" +
                            "                                    详情<span style=\"top: 2px;\" class=\"glyphicon glyphicon-triangle-right\"></span>" +
                            "                                    <span style=\"display: none;top: 2px;\" class=\"glyphicon glyphicon-triangle-bottom\"></span>" +
                            "                                </span>" +
                            "                            </div>" +
                            "                            <div style=\"padding: 5px  15px;\">" +
                            "                                <span>主述：</span><span>" + data[i].zhushu + "</span>" +
                            "                            </div>" +
                            "                        </div>" +
                            "                        <div style=\"flex: 1;text-align: center;\">" +
                            "                            <div style=\"padding: 5px  15px;border-bottom: 1px solid #dddddd;background: #ebfaff;color: #00A8CB;border-left: none;height: 35px;\">";
                        html += "   </div>" +
                            "                            <div class=\"doctorHide\" style=\"padding: 5px  15px;\"><span>医生：</span><span>" + data[i].doctorId + "</span>" +
                            "                            </div>" +
                            "                        </div>" +
                            "                    </div>" +
                            "                    <div id=\"" + data[i].id + "\" style=\"display: none\" class=\"foldBox\">" +
                            "                        <div style=\"display: flex;border: 1px solid #dddddd;border-top: none;\">" +
                            "                            <div style=\"flex: 1.2;text-align: center;margin-top: 20px;color: #00A8CB;\"></div>" +
                            "                            <div style=\"flex: 6;border-right: 1px solid #dddddd;border-left: 1px solid #dddddd\">" +
                            "                                <ul class=\"clearfix ulBox\">";
                        if (data[i].zhushu != "") {
                            html += " <li style=\"border-bottom: 1px solid #dddddd;padding: 5px 10px;\">" +
                                "                                        <div><span style=\"font-weight: bold;\">主诉：</span><span>" + data[i].zhushu + "</span></div>" +
                                "                                    </li>";
                        }
                        if (data[i].nowMedicalHistory != "") {
                            html += "<li style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                                "                                        <div><span style=\"font-weight: bold;\">现病史：</span><span>" + data[i].nowMedicalHistory + "</span></div>" +
                                "                                    </li>";
                        }
                        if (data[i].beforeMedicalHistory != "") {
                            html += "<li style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                                "                                        <div><span style=\"font-weight: bold;\">既往史：</span><span>" + data[i].beforeMedicalHistory + "</span></div>" +
                                "                                    </li>";
                        }
                        html += " <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%;\">口腔检查：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";
                        for (var u = 0; u < data[i].toothSite1List.length; u++) {
                            if (data[i].toothSite1List[u].remarks != "") {
                                html += "<div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\"" +
                                    "                                                         style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite1List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite1List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite1List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite1List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite1List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += " </div>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                    <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%;\">辅助检查：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";
                        for (var u = 0; u < data[i].toothSite2List.length; u++) {
                            if (data[i].toothSite2List[u].remarks != "") {
                                html += "<div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\" style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite2List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite2List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite2List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite2List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite2List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += "</div>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                    <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%\">诊断：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";
                        for (var u = 0; u < data[i].toothSite3List.length; u++) {
                            if (data[i].toothSite3List[u].remarks != "") {
                                html += " <div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\"" +
                                    "                                                         style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite3List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite3List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite3List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite3List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite3List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += "</div>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                    <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%\">治疗计划：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";

                        for (var u = 0; u < data[i].toothSite4List.length; u++) {
                            if (data[i].toothSite4List[u].remarks != "") {
                                html += "<div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\"" +
                                    "                                                         style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite4List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite4List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite4List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite4List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite4List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += "</div>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                    <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%\">处置：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";
                        for (var u = 0; u < data[i].toothSite5List.length; u++) {
                            if (data[i].toothSite5List[u].remarks != "") {
                                html += "<div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\"" +
                                    "                                                         style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite5List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite5List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite5List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite5List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite5List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += "</div>" +
                            "                                        </div>" +
                            "                                    </li>";
                        if (data[i].doctorAdvice != "") {
                            html += "<li style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                                "                                        <div>" +
                                "                                            <span style=\"font-weight: bold;\">医嘱：</span><span>" + data[i].doctorAdvice + "</span>" +
                                "                                        </div>" +
                                "                                    </li>";
                        }
                        if (data[i].remarkss != "") {
                            html += "<li style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                                "                                        <div>" +
                                "                                            <span style=\"font-weight: bold;\">备注：</span><span>" + data[i].remarkss + "</span>" +
                                "                                        </div>" +
                                "                                    </li>";
                        }
                        html += "<li style=\"border: none\">" +
                            "                                        <div style=\"text-align: center\">" +
                            "                                            <button type=\"button\" class=\"btn\" onclick=\"CaseTableList.prints('" + data[i].id + "')\"" +
                            "                                                    style=\"background: white;border: 1px solid #cccccc;padding: 2px 14px;margin-top: 6px;\">打印病历" +
                            "                                            </button>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                </ul>" +
                            "                            </div>" +
                            "                            <div style=\"flex: 1\">" +
                            "                                <h5 style=\"padding-left: 22px; margin: 20px 0\">医生：" + data[i].doctorId + "</h5>" +
                            "                                <h5 style=\"padding-left: 22px; margin: 20px 0\">护士：" + data[i].nurseId + "</h5>" +
                            "                            </div>" +
                            "                        </div>" +
                            "                    </div>" +
                            "                </div>";
                    }
                    else {
                        html +="<div style=\"margin-bottom: 20px;\">\n" +
                            "                    <div class=\"fold\" style=\"display: flex;border: 1px solid #dddddd;\">\n" +
                            "                        <div style=\"flex: 1.2;text-align: center\">\n" +
                            "                            <div style=\"padding: 5px  15px;\">\n" +
                            "                                <span style=\"color: #00A8CB;\">"+data[i].finnallyTime1+"</span>\n" +
                            "                            </div>\n" +
                            "                            <div class=\"doctorHide\" style=\"padding: 5px  15px;border-top: 1px solid #dddddd\"></div>\n" +
                            "                        </div>\n" +
                            "                        <div style=\"flex: 6;border-right: 1px solid #dddddd;border-left: 1px solid #dddddd;\">\n" +
                            "                            <div style=\"padding: 5px  15px;border: 1px solid #dddddd;background: #ebfaff;position: relative\">\n" +
                            "                                <span>\n" +
                            "                                    <span>复诊病历</span><span>|</span><span>治疗：</span>";
                        for (var l = 0; l < data[i].toothSite4List.length; l++) {
                            html += " <span class=\"textHide\">" + data[i].toothSite4List[l].remarks + "</span>";
                        }
                        html += " </span>" +
                            "                                <span style=\"width: 60px;color: #00A8CB;cursor:pointer;position: absolute;right: 0;\" class=\"details\">" +
                            "                                    详情<span style=\"top: 2px;\" class=\"glyphicon glyphicon-triangle-right\"></span>" +
                            "                                    <span style=\"display: none;top: 2px;\" class=\"glyphicon glyphicon-triangle-bottom\"></span>" +
                            "                                </span>" +
                            "                            </div>" +
                            "                            <div style=\"padding: 5px  15px;\">" +
                            "                                <span>复诊：</span><span>" + data[i].zhushu + "</span>" +
                            "                            </div>" +
                            "                        </div>" +
                            "                        <div style=\"flex: 1;text-align: center;\">" +
                            "                            <div style=\"padding: 5px  15px;border-bottom: 1px solid #dddddd;background: #ebfaff;color: #00A8CB;border-left: none;height: 35px;\">";

                        html += " " +
                            " </div>" +
                            "                            <div class=\"doctorHide\" style=\"padding: 5px  15px;\"><span>医生：</span><span>" + data[i].doctorId + "</span>" +
                            "                            </div>" +
                            "                        </div>" +
                            "                    </div>" +
                            "                    <div id=\"" + data[i].id + "\" style=\"display: none\" class=\"foldBox\">" +
                            "                        <div style=\"display: flex;border: 1px solid #dddddd;border-top: none;\">" +
                            "                            <div style=\"flex: 1.2;text-align: center;margin-top: 20px;color: #00A8CB;\"></div>" +
                            "                            <div style=\"flex: 6;border-right: 1px solid #dddddd;border-left: 1px solid #dddddd\">" +
                            "                                <ul class=\"clearfix ulBox\">";
                        if (data[i].zhushu != "") {
                            html += " <li style=\"border-bottom: 1px solid #dddddd;padding: 5px 10px;\">" +
                                "                                        <div><span style=\"font-weight: bold;\">复诊：</span><span>" + data[i].zhushu + "</span></div>" +
                                "                                    </li>";
                        }
                        if (data[i].nowMedicalHistory != "") {
                            html += "<li style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                                "                                        <div><span style=\"font-weight: bold;\">现病史：</span><span>" + data[i].nowMedicalHistory + "</span></div>" +
                                "                                    </li>";
                        }
                        if (data[i].beforeMedicalHistory != "") {
                            html += "<li style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                                "                                        <div><span style=\"font-weight: bold;\">既往史：</span><span>" + data[i].beforeMedicalHistory + "</span></div>" +
                                "                                    </li>";
                        }
                        html += " <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%;\">口腔检查：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";
                        for (var u = 0; u < data[i].toothSite1List.length; u++) {
                            if (data[i].toothSite1List[u].remarks != "") {
                                html += "<div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\"" +
                                    "                                                         style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite1List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite1List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite1List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite1List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite1List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += " </div>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                    <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%;\">辅助检查：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";
                        for (var u = 0; u < data[i].toothSite2List.length; u++) {
                            if (data[i].toothSite2List[u].remarks != "") {
                                html += "<div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\" style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite2List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite2List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite2List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite2List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite2List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += "</div>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                    <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%\">诊断：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";
                        for (var u = 0; u < data[i].toothSite3List.length; u++) {
                            if (data[i].toothSite3List[u].remarks != "") {
                                html += " <div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\"" +
                                    "                                                         style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite3List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite3List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite3List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite3List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite3List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += "</div>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                    <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%\">治疗计划：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";

                        for (var u = 0; u < data[i].toothSite4List.length; u++) {
                            if (data[i].toothSite4List[u].remarks != "") {
                                html += "<div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\"" +
                                    "                                                         style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite4List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite4List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite4List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite4List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite4List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += "</div>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                    <li>" +
                            "                                        <div class=\"clearfix\" style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                            "                                            <div class=\"col-sm-2 typeStyle kouqiang\"" +
                            "                                                 style=\"font-weight: bold;width: 10%\">处置：" +
                            "                                            </div>" +
                            "                                            <div class=\"col-sm-10\" style=\"padding: 0;\">";
                        for (var u = 0; u < data[i].toothSite5List.length; u++) {
                            if (data[i].toothSite5List[u].remarks != "") {
                                html += "<div class=\"col-sm-12\" style=\"padding: 0;margin-bottom: 3px;\">" +
                                    "                                                    <div class=\"col-sm-2\"" +
                                    "                                                         style=\"height:28px;display: flex;flex-wrap:wrap;\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;border-bottom: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite5List[u].leftUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-bottom: 1px solid black;padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite5List[u].rightUp + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"border-right: 1px solid black;text-align: right;padding-right: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite5List[u].leftDown + "\">" +
                                    "                                                        <input readonly=\"readonly\" class=\"tool_ipt\"" +
                                    "                                                               style=\"padding-left: 4px\"" +
                                    "                                                               value=\"" + data[i].toothSite5List[u].rightDown + "\">" +
                                    "                                                    </div>" +
                                    "                                                    <div class=\"col-sm-10 typeStyle\">" + data[i].toothSite5List[u].remarks + "</div>" +
                                    "                                                </div>";
                            }
                        }
                        html += "</div>" +
                            "                                        </div>" +
                            "                                    </li>";
                        if (data[i].doctorAdvice != "") {
                            html += "<li style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                                "                                        <div>" +
                                "                                            <span style=\"font-weight: bold;\">医嘱：</span><span>" + data[i].doctorAdvice + "</span>" +
                                "                                        </div>" +
                                "                                    </li>";
                        }
                        if (data[i].remarkss != "") {
                            html += "<li style=\"padding: 5px 10px;border-bottom: 1px solid #dddddd\">" +
                                "                                        <div>" +
                                "                                            <span style=\"font-weight: bold;\">备注：</span><span>" + data[i].remarkss + "</span>" +
                                "                                        </div>" +
                                "                                    </li>";
                        }
                        html += "<li style=\"border: none\">" +
                            "                                        <div style=\"text-align: center\">" +
                            "                                            <button type=\"button\" class=\"btn\" onclick=\"CaseTableList.printss('" + data[i].id + "')\"" +
                            "                                                    style=\"background: white;border: 1px solid #cccccc;padding: 2px 14px;margin-top: 6px;\">打印病历" +
                            "                                            </button>" +
                            "                                        </div>" +
                            "                                    </li>" +
                            "                                </ul>" +
                            "                            </div>" +
                            "                            <div style=\"flex: 1\">" +
                            "                                <h5 style=\"padding-left: 22px; margin: 20px 0\">医生：" + data[i].doctorId + "</h5>" +
                            "                                <h5 style=\"padding-left: 22px; margin: 20px 0\">护士：" + data[i].nurseId + "</h5>" +
                            "                            </div>" +
                            "                        </div>" +
                            "                    </div>" +
                            "                </div>";
                    }
                }
                html += "</div>" +
                    "        </div>" +
                    "    </div>" +
                    "</div>";
                html += "<script>" +
                    "$(\".details\").click(function () {" +
                    "    $(this).children().toggle();" +
                    "    $(this).parent().parent().siblings().children('.doctorHide').toggle();" +
                    "    $(this).parent().siblings().toggle();" +
                    "    $(this).parents('.fold').siblings('.foldBox').toggle();" +
                    "});" +
                    "</script>";
            }
            $("#case").html(html);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
}

//收费记录-账单记录
function chargingRecord() {
    $.ajax({
        url: Feng.ctxPath + "/customerDetails/chargingRecord",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            var html = "<div>" +
                "            <div style=\"display: flex;padding: 10px 0\">" +
                "                <div style=\"flex: 1\">" +
                "                    <span>已收费</span>" +
                "                    <span><label><input style=\"vertical-align: sub;\" class=\"dealCheck\" id=\"settleCheck\"" +
                "                                        checked=\"checked\" type=\"checkbox\">结清</label></span>" +
                "                    <span><label><input style=\"vertical-align: sub;\" class=\"dealCheck\" id=\"refundCheck\"" +
                "                                        checked=\"checked\" type=\"checkbox\">退款</label></span>" +
                "                    <span><label><input style=\"vertical-align: sub;\" class=\"dealCheck\" id=\"arrearsCheck\"" +
                "                                        checked=\"checked\" type=\"checkbox\">欠费</label></span>" +
                "                    <span><label><input style=\"vertical-align: sub;\" class=\"dealCheck\" id=\"deductionCheck\"" +
                "                                        checked=\"checked\" type=\"checkbox\">抵扣</label></span>" +
                "                    <span style=\"margin-left: 10px;font-weight: bold;\">实收总额 <span style=\"font-size: 16px;\">" + data.totalPayDealActualPay + "</span></span>" +
                "                    <span style=\"margin-left: 10px;font-weight: bold;\">欠费总额 <span style=\"font-size: 16px;color: red\">" + data.totalPayDealArrears + "</span></span>" +
                "                </div>" +
                "                <div class=\"chargeBtn\" style=\"text-align: right\">" +
                "                </div>" +
                "            </div>" +
                "            <div style=\"border-bottom: 2px solid #ff7e00;border-top: 2px solid #ff7e00;\">" +
                "                <div style=\"display: flex;padding: 6px 0;border-bottom: 1px solid #ff7e00;color: #666a73;text-align: center\">" +
                "                    <div style=\"flex: 1;\">展开</div>" +
                "                    <div style=\"flex: 1;\">操作诊所</div>" +
                "                    <div style=\"flex: 1;\">单据号</div>" +
                "                    <div style=\"flex: 2;\">首次收费时间</div>" +
                "                    <div style=\"flex: 1;\">账单状态</div>" +
                "                    <div style=\"flex: 1;\">医生</div>" +
                "                    <div style=\"flex: 1;\">护士</div>" +
                "                    <div style=\"flex: 1;\">TC</div>" +
                "                    <div style=\"flex: 1;\">应收</div>" +
                "                    <div style=\"flex: 1;\">实收</div>" +
                "                    <div style=\"flex: 1;\">优惠抵扣</div>" +
                "                    <div style=\"flex: 1;\">欠费汇总</div>" +
                "                    <div style=\"flex: 2;\">备注</div>" +
                "                    <div style=\"flex: 2.5;\">操作</div>" +
                "                </div>" +
                "                <div id=\"orderhtml\">";
            for (var i = 0; i < data.arrearsDealList.length; i++) {
                html += "<div class=\"order\">" +
                    "                        <div style=\"display: flex;text-align: center;border-bottom: 1px solid #DDDDDD;padding: 5px 0\">" +
                    "                            <div style=\"flex: 1;\" class=\"showDetail\" onclick=\"showDetail(this)\">" +
                    "                                <span class=\"glyphicon glyphicon-collapse-down\"></span>" +
                    "                                <span class=\"glyphicon glyphicon-collapse-up\" style=\"display: none\"></span>" +
                    "                            </div>" +
                    "                            <div style=\"flex: 1;\">" + data.arrearsDealList[i].outpatientName + "</div>" +
                    "                            <div style=\"flex: 1;\">" + data.arrearsDealList[i].documentNumber + "</div>" +
                    "                            <div style=\"flex: 2;\" class=\"beyond\" title=\"" + data.arrearsDealList[i].operationTime + "\">" + data.arrearsDealList[i].operationTime + "</div>" +
                    "                            <div style=\"flex: 1;\">" + data.arrearsDealList[i].dealStatus + "</div>" +
                    "                            <div style=\"flex: 1;\" class=\"beyond\" title=\"" + data.arrearsDealList[i].doctor + "\">" + data.arrearsDealList[i].doctor + "</div>" +
                    "                            <div style=\"flex: 1\">" + data.arrearsDealList[i].nurse + "</div>" +
                    "                            <div style=\"flex: 1;\">" + data.arrearsDealList[i].tcName + "</div>" +
                    "                            <div style=\"flex: 1;\">" + data.arrearsDealList[i].foldingPay + "</div>" +
                    "                            <div style=\"flex: 1;\">" + (parseFloat(data.arrearsDealList[i].serviceActualPay) + parseFloat(data.arrearsDealList[i].depositAmount)) + "</div>" +
                    "                            <div style=\"flex: 1;\">" + data.arrearsDealList[i].deductionAmount + "</div>" +
                    "                            <div class=\"dealArrears\" style=\"flex: 1;\">" + data.arrearsDealList[i].arrears + "</div>" +
                    "                            <div style=\"flex: 2;\" class=\"beyond\" title=\"" + data.arrearsDealList[i].remarks + "\">" + data.arrearsDealList[i].remarks + "</div>" +
                    "                            <div class=\"dealDeductionAmount\" style=\"display: none\">" + data.arrearsDealList[i].deductionAmount + "</div>" +
                    "                            <div style=\"flex: 2.5;\">" +
                    "                                <span><a href=\"javascript:;\" onclick=\"openingDetails('" + data.arrearsDealList[i].operationTime + "','" + data.arrearsDealList[i].outpatientName + "')\">首次开单详情</a></span>" +
                    "                                <span><a href=\"javascript:;\" onclick=\"detailsPrint('" + data.arrearsDealList[i].operationTime + "','" + data.arrearsDealList[i].outpatientName + "')\">打印</a></span>" +
                    "                                <span><a href=\"javascript:;\" onclick=\"refundTotal('" + data.arrearsDealList[i].operationTime + "','" + data.arrearsDealList[i].serviceActualPay + "','" + data.arrearsDealList[i].depositAmount + "','" + data.arrearsDealList[i].outpatientName + "','" + data.arrearsDealList[i].tcName + "')\">退款</a></span>" +
                    "                                <span><a href=\"javascript:;\" onclick=\"updateAchievement('" + data.arrearsDealList[i].operationTime + "','" + data.arrearsDealList[i].outpatientName + "')\">变更医生</a></span>" +
                    "                            </div>" +
                    "                        </div>" +
                    "                        <div style=\"padding: 15px 20px;overflow: hidden;display: none\">" +
                    "                            <div class=\"dealInfoList\"" +
                    "                                 style=\"box-shadow: 0 0 8px #cccccc;border-radius: 6px;overflow: hidden;\">" +
                    "                                <div style=\"display: flex;padding: 4px 0;background: #fec182;color: #666a73;text-align: center\">" +
                    "                                    <div style=\"flex: 1;\">操作诊所</div>" +
                    "                                    <div style=\"flex: 2;\">交易时间</div>" +
                    "                                    <div style=\"flex: 1;\">交易类型</div>" +
                    "                                    <div style=\"flex: 1;\">交易状态</div>" +
                    "                                    <div style=\"flex: 1;\">收费人</div>" +
                    "                                    <div style=\"flex: 1;\">医生</div>" +
                    "                                    <div style=\"flex: 1;\">护士</div>" +
                    "                                    <div style=\"flex: 1;\">实收</div>" +
                    "                                    <div style=\"flex: 1;\">优惠抵扣</div>" +
                    "                                    <div style=\"flex: 1.5;\">收费方式</div>" +
                    "                                    <div style=\"flex: 2;\">备注</div>" +
                    "                                    <div style=\"flex: 2.5;\">操作</div>" +
                    "                                </div>";
                for (var j = 0; j < data.arrearsDealList[i].dealList.length; j++) {
                    html += "                                <div class=\"openOrder\" style=\"display: flex;padding: 7px 0;border-top: 1px solid #eeeeee;text-align: center;\">" +
                        "                                    <div style=\"flex: 1;\">" + data.arrearsDealList[i].dealList[j].outpatientName + "</div>" +
                        "                                    <div style=\"flex: 2;\">" + data.arrearsDealList[i].dealList[j].getTime + "</div>";
                    if (data.arrearsDealList[i].dealList[j].isDo == 1) {
                        html += " <div class=\"dealType\" style=\"flex: 1;\">储值划扣</div>";
                    }
                    if (data.arrearsDealList[i].dealList[j].isDo == 2) {
                        html += " <div class=\"dealType\" style=\"flex: 1;\">继续做</div>";
                    }
                    if (data.arrearsDealList[i].dealList[j].isDo == 3) {
                        html += " <div class=\"dealType\" style=\"flex: 1;\">还欠款</div>";
                    }
                    if (data.arrearsDealList[i].dealList[j].isDo == 4) {
                        html += " <div class=\"dealType\" style=\"flex: 1;\">退款</div>";
                    }
                    if (data.arrearsDealList[i].dealList[j].isDo == 5) {
                        html += " <div class=\"dealType\" style=\"flex: 1;\">消费</div>";
                    }
                    if (data.arrearsDealList[i].dealList[j].dealStatus == "已开单") {
                        html += " <div class=\"dealType\" style=\"flex: 1;\">作废</div>";
                    }
                    if (data.arrearsDealList[i].dealList[j].dealStatus == "已结账") {
                        html += " <div style=\"flex: 1;\">已结账</div>";
                    }
                    html += " <div style=\"flex: 1;\">" + data.arrearsDealList[i].dealList[j].rechargePeople + "</div>" +
                        "                                    <div style=\"flex: 1;\">" + data.arrearsDealList[i].dealList[j].doctor + "</div>" +
                        "                                    <div style=\"flex: 1\">" + data.arrearsDealList[i].dealList[j].nurse + "</div>" +
                        "                                    <div style=\"flex: 1;\" class=\"beyond\" title=\"" + data.arrearsDealList[i].dealList[j].serviceActualPay + "元\">" +
                        "                                       " + data.arrearsDealList[i].dealList[j].serviceActualPay + " 元" +
                        "                                    </div>" +
                        "                                    <div style=\"flex: 1;\" class=\"beyond\" title=\"" + data.arrearsDealList[i].dealList[j].deductionAmount + "\">" +
                        "                                        " + data.arrearsDealList[i].dealList[j].deductionAmount + "" +
                        "                                    </div>" +
                        "                                    <div style=\"flex: 1.5;\" class=\"beyond\" title=\"(" + data.arrearsDealList[i].dealList[j].checkoutMethod + ")\">" +
                        "                                        (" + data.arrearsDealList[i].dealList[j].checkoutMethod + ")" +
                        "                                    </div>" +
                        "                                    <div style=\"flex: 2;\" class=\"beyond\" title=\"" + data.arrearsDealList[i].dealList[j].remarks + "\">" +
                        "                                        " + data.arrearsDealList[i].dealList[j].remarks + "" +
                        "                                    </div>" +
                        "                                    <div style=\"flex: 2.5\">" +
                        "                                        <a onclick=\"printingDeal('" + data.arrearsDealList[i].dealList[j].operationTime + "','" + data.arrearsDealList[i].dealList[j].outpatientName + "','" + data.arrearsDealList[i].dealList[j].getTime + "','" + document.getElementById("reservationsId").value + "')\">详情打印</a>" +
                        "                                        <a onclick=\"updateDoctorDeal('" + data.arrearsDealList[i].dealList[j].getTime + "','" + data.arrearsDealList[i].dealList[j].outpatientName + "')\">变更医生</a>" +
                        "                                        <a onclick=\"updateRemarksDeal('" + data.arrearsDealList[i].dealList[j].getTime + "','" + data.arrearsDealList[i].dealList[j].outpatientName + "')\">修改备注</a>" +
                        "                                    </div>" +
                        "                                </div>";
                }
                html += "         </div>" +
                    "                        </div>" +
                    "                    </div>";
            }
            html += "         </div>" +
                "                        </div>" +
                "                    </div>";
            $("#chargeContent").html(html);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
}

//收费记录-支付记录
function paymentRecords() {
    $.ajax({
        url: Feng.ctxPath + "/customerDetails/paymentRecords",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            var html = "<div style=\"padding: 10px 0;font-weight: bolder;\">" +
                "                <span>支付记录</span>" +
                "                <span>实收总额 <span style=\"font-size: 16px;\">" + data.totalPayDealActualPay + "</span></span>" +
                "                <span>欠费总额 <span style=\"font-size: 16px;color: red\">" + data.totalPayDealArrears + "</span></span>" +
                "            </div>" +
                "            <div style=\"border-bottom: 2px solid #ff7e00\">" +
                "                <div style=\"display: flex;border-bottom: 1px solid #ff7e00;border-top: 2px solid #ff7e00;padding: 5px;text-align: center;\">" +
                "                    <div style=\"flex: 1\">操作诊所</div>" +
                "                    <div style=\"flex: 2\">交易时间</div>" +
                "                    <div style=\"flex: 1\">交易类型</div>" +
                "                    <div style=\"flex: 1\">交易状态</div>" +
                "                    <div style=\"flex: 1\">收费人</div>" +
                "                    <div style=\"flex: 1\">TC</div>" +
                "                    <div style=\"flex: 1\">财务应收</div>" +
                "                    <div style=\"flex: 1\">应收</div>" +
                "                    <div style=\"flex: 1\">实收</div>" +
                "                    <div style=\"flex: 1\">优惠抵扣</div>" +
                "                    <div style=\"flex: 1\">欠费变动</div>" +
                "                    <div style=\"flex: 1\">备注</div>" +
                "                </div>";
            for (var i = 0; i < data.arrearsDealList.length; i++) {
                html += "<div style=\"display: flex;border-bottom: 1px solid #DDDDDD;padding: 5px;text-align: center;\">";
                if (data.arrearsDealList[i].isDo == 3) {
                    html += "<div style=\"flex: 1\">" + data.arrearsDealList[i].outpatientName + "</div>" +
                        "                    <div style=\"flex: 2\">" + data.arrearsDealList[i].getTime + "</div>" +
                        "                    <div style=\"flex: 1;\">还欠款</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].dealStatus + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].rechargePeople + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].tcName + "</div>" +
                        "                    <div style=\"flex: 1\">" + (data.arrearsDealList[i].foldingPay - data.arrearsDealList[i].deductionAmount) + "</div>" +
                        "                    <div style=\"flex: 1\">0.0</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].serviceActualPay + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].deductionAmount + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].arrears + "</div>" +
                        "                    <div style=\"flex: 1\" class=\"beyond\" title=\"" + data.arrearsDealList[i].remarks + "\">" + data.arrearsDealList[i].remarks + "</div>";
                }
                if (data.arrearsDealList[i].isDo == 4) {
                    html += "<div style=\"flex: 1\">" + data.arrearsDealList[i].outpatientName + "</div>" +
                        "                    <div style=\"flex: 2\">" + data.arrearsDealList[i].getTime + "</div>" +
                        "                    <div style=\"flex: 1;\">退款</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].dealStatus + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].rechargePeople + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].tcName + "</div>" +
                        "                    <div style=\"flex: 1\">" + (data.arrearsDealList[i].serviceActualPay + data.arrearsDealList[i].arrears) + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].tkfoldingPay + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].serviceActualPay + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].deductionAmount + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].arrears + "</div>" +
                        "                    <div style=\"flex: 1\" class=\"beyond\" title=\"" + data.arrearsDealList[i].remarks + "\">" + data.arrearsDealList[i].remarks + "</div>";
                }
                if (data.arrearsDealList[i].isDo == 5) {
                    html += "<div style=\"flex: 1\">" + data.arrearsDealList[i].outpatientName + "</div>" +
                        "                    <div style=\"flex: 2\">" + data.arrearsDealList[i].getTime + "</div>" +
                        "                    <div style=\"flex: 1;\">消费</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].dealStatus + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].rechargePeople + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].tcName + "</div>" +
                        "                    <div style=\"flex: 1\">" + (data.arrearsDealList[i].foldingPay - data.arrearsDealList[i].deductionAmount) + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].foldingPay + "</div>" +
                        "                    <div style=\"flex: 1\">" + (data.arrearsDealList[i].serviceActualPay + data.arrearsDealList[i].depositAmount) + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].deductionAmount + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].arrears + "</div>" +
                        "                    <div style=\"flex: 1\" class=\"beyond\" title=\"" + data.arrearsDealList[i].remarks + "\">" + data.arrearsDealList[i].remarks + "</div>";
                }
                if (data.arrearsDealList[i].isDo == 6) {
                    html += "<div style=\"flex: 1\">" + data.arrearsDealList[i].outpatientName + "</div>" +
                        "                    <div style=\"flex: 2\">" + data.arrearsDealList[i].getTime + "</div>" +
                        "                    <div style=\"flex: 1;\">作废</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].dealStatus + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].rechargePeople + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].tcName + "</div>" +
                        "                    <div style=\"flex: 1\">" + (data.arrearsDealList[i].foldingPay - data.arrearsDealList[i].deductionAmount) + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].foldingPay + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].serviceActualPay + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].deductionAmount + "</div>" +
                        "                    <div style=\"flex: 1\">" + data.arrearsDealList[i].arrears + "</div>" +
                        "                    <div style=\"flex: 1\" class=\"beyond\" title=\"" + data.arrearsDealList[i].remarks + "\">" + data.arrearsDealList[i].remarks + "</div>";
                }
                html += " </div>";
            }
            html += " </div>" +
                "</div>";
            $("#chargeContent").html(html);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
}

//收费记录-收欠款
var checkoutMethodHtmls;

function arrearageRecord() {
    $.ajax({
        url: Feng.ctxPath + "/customerDetails/arrearageRecord",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            checkoutMethodHtmls = data.checkoutMethodHtml;
            var html = "<div style=\"border-bottom: 2px solid #FF7E00;margin-top: 10px;\">" +
                "                <div id=\"arrearsDeal2\">" +
                "                    <div style=\"display: flex;border-bottom: 1px solid #FF7E00;border-top: 2px solid #FF7E00;padding: 5px;text-align: center;\">" +
                "                        <div style=\"flex: 0.4\"></div>" +
                "                        <div style=\"flex: 1\">诊所</div>" +
                "                        <div style=\"flex: 1.2\">首次收费时间</div>" +
                "                        <div style=\"flex: 2\">欠费项目</div>" +
                "                        <div style=\"flex: 1\">tc</div>" +
                "                        <div style=\"flex: 1\">医生</div>" +
                "                        <div style=\"flex: 1;\">护士</div>" +
                "                        <div style=\"flex: 1\">应收</div>" +
                "                        <div style=\"flex: 1\">实收</div>" +
                "                        <div style=\"flex: 1\">优惠抵扣</div>" +
                "                        <div style=\"flex: 1\">欠费</div>" +
                "                        <div style=\"flex: 1\">备注</div>" +
                "                    </div>";
            for (var i = 0; i < data.arrearsDealList.length; i++) {
                html += "<div class=\"arrearsDeal\" style=\"display: flex;border-bottom: 1px solid #DDDDDD;padding: 5px;text-align: center;\">" +
                    "                        <div style=\"flex: 0.4\"><input onclick=\"chooseArrearsDeal(this)\" class=\"id\" value=\"" + data.arrearsDealList[i].operationTime + "\" type=\"radio\" name=\"checkedres\"></div>" +
                    "                        <div class=\"arrearsOutpatientName\" style=\"flex: 1\">" + data.arrearsDealList[i].outpatientName + "</div>" +
                    "                        <div style=\"flex: 1.3\" class=\"beyond\" title=\"" + data.arrearsDealList[i].operationTime + "\">" + data.arrearsDealList[i].operationTime + "</div>" +
                    "                        <div style=\"flex: 2\" class=\"beyond\" title=\"" + data.arrearsDealList[i].payServiceName + "\">" + data.arrearsDealList[i].payServiceName + "</div>" +
                    "                        <div style=\"flex: 1\" class=\"atcName\">" + data.arrearsDealList[i].tcName + "</div>" +
                    "                        <div style=\"flex: 1\">" + data.arrearsDealList[i].doctor + "</div>" +
                    "                        <div style=\"flex: 1\">" + data.arrearsDealList[i].nurse + "</div>" +
                    "                        <div style=\"flex: 1\">" + data.arrearsDealList[i].foldingPay + "</div>" +
                    "                        <div style=\"flex: 1\">" + data.arrearsDealList[i].serviceActualPay + "</div>" +
                    "                        <div style=\"flex: 1\">" + data.arrearsDealList[i].deductionAmount + "</div>" +
                    "                        <div style=\"flex: 1\" class=\"arrears\">" + data.arrearsDealList[i].arrears + "</div>" +
                    "                        <div style=\"flex: 1\" class=\"beyond\" title=\"" + data.arrearsDealList[i].remarks + "\">" + data.arrearsDealList[i].remarks + "</div>" +
                    "                    </div>";
            }
            html += "</div>" +
                "                <div style=\"text-align: right;padding: 10px 0;color: #FF7E00;font-size: 14px;font-weight: bolder;border-top: 1px solid #FF7E00\">" +
                "                    <span>总计应收</span>" +
                "                    <span id=\"totalArrearsAmount\">" + data.totalArrearsAmount + "</span>" +
                "                </div>" +
                "            </div>" +
                "            <div>" +
                "                <div style=\"margin-top: 10px;width: 600px;background: #f4f4f4;border-radius: 3px;padding: 7px 15px;display:flex\" >" +
                "                    <label style=\"flex: 1;\" for=\"earnests\">" +
                "                        <input type=\"checkbox\" id=\"earnests\" value=\"储值划扣\" style=\"vertical-align: middle\">" +
                "                        <span style=\"vertical-align: sub;\">储值余额<span id=\"moneyBalance2\" style=\"margin-left: 10px;\">" +
                "                           " + data.khmoneyBalance + "</span></span>" +
                "                    </label>" +
                "                    <label style=\"flex: 1\" for=\"integrals\">" +
                "                        <input type=\"checkbox\" id=\"integrals\" value=\"使用返现\" style=\"vertical-align: middle\">" +
                "                        <span style=\"vertical-align: sub;\">使用返现/优惠券可抵扣金额<span id=\"jfbalance2\" style=\"margin-left: 10px;\">" +
                "                           " + data.khjfbalance + " </span></span>" +
                "                    </label>" +
                "                </div>" +
                "                <div id=\"inquireAboutBox\" style=\"border-top: 2px solid #ff7e00;border-bottom: 2px solid #ff7e00;margin: 10px 0;display: none\">" +
                "                    <div style=\"border-bottom: 1px solid #ff7e00;display: flex;padding: 5px 0;text-align: center;\">" +
                "                        <div style=\"flex: 2;padding-left: 5px;text-align: left\">项目名称</div>" +
                "                        <div style=\"flex: 0.5\">单价</div>" +
                "                        <div style=\"flex: 0.5\">数量</div>" +
                "                        <div style=\"flex: 0.5\">欠款</div>" +
                "                        <div style=\"flex: 1;display: none\" class=\"deduction2\">划扣储值</div>" +
                "                        <div style=\"flex: 1;display: none\" class=\"application2\">抵用方式</div>" +
                "                        <div style=\"flex: 1;display: none\" class=\"sumMoney2\">抵用金额</div>" +
                "                    </div>" +
                "                    <div id=\"inquireAbout\"></div>" +
                "                </div>" +
                "                <div style=\"background: #f4f4f4;padding: 7px 15px;display: flex;border-radius: 3px;overflow: hidden;margin-top: 10px;\">" +
                "                    <div style=\"display: flex;background: white;padding: 4px 12px;border-radius: 3px;font-weight: bolder;\">" +
                "                        <div><span>总欠款：</span><span id=\"chooseDealArrears\" style=\"font-size: 16px;color: red;\">0.00</span></div>" +
                "                    </div>" +
                "                    <div style=\"padding-left: 30px;line-height: 30px;\">" +
                "                        <span>支付金额：</span>" +
                "                        <input id=\"arrearsAmount\" autocomplete=\"off\" style=\"width: 60%;height: 30px;margin-left: 5px;padding-left: 5px;\"" +
                "                               type=\"text\" oninput=\"decimalNum(this),changeAmount()\" value=\"0\">" +
                "                    </div>" +
                "                </div>" +
                "                <div style=\"background: #f4f4f4;margin-top: 10px;padding:10px 15px;border-radius: 3px;overflow: hidden;\">" +
                "                    <div>" +
                "                        <span style=\"width: 80px;display: inline-block;text-align: right;font-weight: bolder\">开单tc：</span>" +
                "                        <select name=\"aTcName\" id=\"aTcName\" style=\"padding-left: 5px;height: 28px;width: 120px;\">" +
                "                            <option value=\"\">请选择</option>";
            for (var j = 0; j < data.tcList.length; j++) {
                html += "<option value=\"" + data.tcList[j].tcName + "\">" + data.tcList[j].tcName + "</option>";
            }
            html += "</select>" +
                "                    </div>" +
                "                    <div style=\"margin-top: 10px;\">" +
                "                        <span style=\"width: 80px;display: inline-block;vertical-align: top;text-align: right;font-weight: bolder\">备注：</span>" +
                "                        <textarea id=\"arrearsRemark\" style=\"height: 60px;width: 35%;padding-left: 5px;\"></textarea>" +
                "                    </div>" +
                "                </div>" +
                "                <div style=\"margin-top: 10px;\">" +
                "                    <div style=\"text-align:center\">" +
                "                        <button onclick=\"repairArrears()\" type=\"button\" class=\"btn btnStyle\" style=\"background: #FF7E00;color: white\">提交</button>" +
                "                        <button onclick=\"parent.layer.close(parent.layer.getFrameIndex(window.name))\" type=\"button\" class=\"btn btnStyle\">关闭</button>" +
                "                    </div>" +
                "                </div>" +
                "            </div>" +
                "        </div>";
            html += "<script>" +
                "$(\"#integrals,#earnests\").click(function () {" +
                "    var reservationsId = $(\"#reservationsId\").val();" +
                "    var operationTime = '';" +
                "    for (var i = 0; i < $(\".arrearsDeal\").length; i++) {" +
                "        if($(\".arrearsDeal\").eq(i).find('.id').is(':checked')){" +
                "            operationTime = $(\".arrearsDeal\").eq(i).find('.id').val();" +
                "            if($('#integrals').is(':checked') && $('#earnests').is(':checked')){" +
                "                $(\"#inquireAboutBox\").show();" +
                "                $(\".deduction2,.application2,.sumMoney2\").show();" +
                "                $(\"#arrearsDeal2\").find('.arrearsDeal').css(\"pointer-events\", \"none\");" +
                "                $.ajax({" +
                "                    url: Feng.ctxPath + \"/consultant/inquireAboutArrears\"," +
                "                    dataType: \"json\"," +
                "                    data: {" +
                "                        \"operationTimes\": operationTime," +
                "                        \"reservationsId\": reservationsId" +
                "                    }," +
                "                    type: \"POST\"," +
                "                    success: function (data) {" +
                "                        var text = \"\";" +
                "                        for(var i=0 ; i<data.length ; i++){" +
                "                            text += '<div class=\"inquireAbout\" id=\"'+data[i].id2+'\" style=\"border-bottom: 1px solid #DDDDDD;display: flex;padding: 7px 0;text-align: center\">' +" +
                "                                '<div style=\"flex: 2;padding-left: 5px;text-align: left\">'+data[i].payServiceName+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\">'+data[i].payService+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\">'+data[i].payServiceNum+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\" class=\"amount2\">'+data[i].arrears+'</div>' +" +
                "                                '<div style=\"flex: 1;\"><input oninput=\"decimalNum(this),onchangeDepositAmount2(this)\" style=\"text-align: center\" type=\"text\" class=\"depositAmount2\" value=\"0\"><input type=\"hidden\" value=\"0\" style=\"display: none\"></div>' +" +
                "                                '<div style=\"flex: 1;\"><select style=\"height: 28px;\" onchange=\"applicationWay2(this)\" class=\"deductionType2\">'+checkoutMethodHtmls+'</select></div>' +" +
                "                                '<div style=\"flex: 1;\"><input oninput=\"decimalNum(this),changeDeductionAmount2(this)\" style=\"text-align: center\" type=\"text\" class=\"deductionAmount2\" value=\"0\"><input type=\"hidden\" value=\"0\" style=\"display: none\"></div>' +" +
                "                                '</div>'" +
                "                        }" +
                "                        $(\"#inquireAbout\").html(text);" +
                "                    }" +
                "                });" +
                "            }else if($('#integrals').is(':checked')){" +
                "                $(\"#inquireAboutBox\").show();" +
                "                $(\".application2,.sumMoney2\").show();" +
                "                $(\".deduction2\").hide();" +
                "                $(\"#arrearsDeal2\").find('.arrearsDeal').css(\"pointer-events\", \"none\");" +
                "                $.ajax({" +
                "                    url: Feng.ctxPath + \"/consultant/inquireAboutArrears\"," +
                "                    dataType: \"json\"," +
                "                    data: {" +
                "                        \"operationTimes\": operationTime," +
                "                        \"reservationsId\": reservationsId" +
                "                    }," +
                "                    type: \"POST\"," +
                "                    success: function (data) {" +
                "                        var text = \"\";" +
                "                        for(var i=0 ; i<data.length ; i++){" +
                "                            text += '<div class=\"inquireAbout\" id=\"'+data[i].id2+'\" style=\"border-bottom: 1px solid #DDDDDD;display: flex;padding: 7px 0;text-align: center;\">' +" +
                "                                '<div style=\"flex: 2;padding-left: 5px;text-align: left\">'+data[i].payServiceName+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\">'+data[i].payService+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\">'+data[i].payServiceNum+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\" class=\"amount2\">'+data[i].arrears+'</div>' +" +
                "                                '<div style=\"flex: 1;\"><select style=\"height: 28px;\" onchange=\"applicationWay2(this)\" class=\"deductionType2\">'+checkoutMethodHtmls+'</select></div>' +" +
                "                                '<div style=\"flex: 1;\"><input oninput=\"decimalNum(this),changeDeductionAmount2(this)\" style=\"text-align: center\" type=\"text\" class=\"deductionAmount2\" value=\"0\"><input type=\"hidden\" value=\"0\" style=\"display: none\"></div>' +" +
                "                                '</div>'" +
                "                        }" +
                "                        $(\"#inquireAbout\").html(text)" +
                "                    }" +
                "                });" +
                "            }else if($('#earnests').is(':checked')){" +
                "                $(\"#inquireAboutBox\").show();" +
                "                $(\".deduction2\").show();" +
                "                $(\".application2,.sumMoney2\").hide();" +
                "                $(\"#arrearsDeal2\").find('.arrearsDeal').css(\"pointer-events\", \"none\");" +
                "                $.ajax({" +
                "                    url: Feng.ctxPath + \"/consultant/inquireAboutArrears\"," +
                "                    dataType: \"json\"," +
                "                    data: {" +
                "                        \"operationTimes\": operationTime," +
                "                        \"reservationsId\": reservationsId" +
                "                    }," +
                "                    type: \"POST\"," +
                "                    success: function (data) {" +
                "                        var text = \"\";" +
                "                        for(var i=0 ; i<data.length ; i++){" +
                "                            text += '<div class=\"inquireAbout\" id=\"'+data[i].id2+'\" style=\"border-bottom: 1px solid #DDDDDD;display: flex;padding: 7px 0;text-align: center\">' +" +
                "                                '<div style=\"flex: 2;padding-left: 5px;text-align: left\">'+data[i].payServiceName+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\">'+data[i].payService+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\">'+data[i].payServiceNum+'</div>' +" +
                "                                '<div style=\"flex: 0.5;\" class=\"amount2\">'+data[i].arrears+'</div>' +" +
                "                                '<div style=\"flex: 1;\"><input oninput=\"decimalNum(this),onchangeDepositAmount2(this)\" style=\"text-align: center\" type=\"text\" class=\"depositAmount2\" value=\"0\"><input type=\"hidden\" value=\"0\" style=\"display: none\"></div>' +" +
                "                                '</div>'" +
                "                        }" +
                "                        $(\"#inquireAbout\").html(text);" +
                "                    }" +
                "                });" +
                "            }else {" +
                "                $(\"#arrearsDeal2\").find('.arrearsDeal').css(\"pointer-events\", \"auto\");" +
                "                $(\"#inquireAbout\").html(\"\");" +
                "                $(\"#inquireAboutBox\").hide();" +
                "            }" +
                "        }" +
                "    }" +
                "});" +
                "</script>";
            $("#chargeContent").html(html);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
}

//是否当前日期
function checkIsYesterdayCust() {
    var arrivalTime = $("#arrivalTimeStr").val();
    var now = new Date();
    var time = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "-" + (now.getDate() < 10 ? "0" : "") + now.getDate();
    if (arrivalTime.indexOf(time) >= 0) {
        return true;
    } else {
        return false;
    }
}

//会员信息
function memberTc() {
    $.ajax({
        url: Feng.ctxPath + "/customerDetails/memberInformation",
        type: "post",
        data: {
            "reservationsId": document.getElementById("reservationsId").value
        },
        success: function (data) {
            var html = " " +
                "<div class=\"home_box\">" +
                "    <div>" +
                "        <span>会员等级：" + data.vipLevelName + "</span>" +
                "        <span>会员卡号：" + data.membersNum + "</span>" +
                "    </div>" +
                "    <div id=\"memberBox\">" +
                "        <div style=\"margin-right: 10px;\">" +
                "            <div class=\"memberTitle\">" +
                "                <div>储值</div>" +
                "                <div>" +
                "                    <div class=\"btnBox\">" +
                "                        <button class=\"btn\" type=\"button\" onclick=\"transactionRecord()\">交易记录</button>" +
                "                    </div>" +
                "                </div>" +
                "            </div>" +
                "            <div>" +
                "                <span>储值余额：</span>" +
                "                <span id=\"moneyBalance\">" + data.moneyBalance + "</span>" +
                "            </div>" +
                "        </div>" +
                "        <div>" +
                "            <div class=\"memberTitle\">" +
                "                <div>积分</div>" +
                "                <div>" +
                "                    <div class=\"btnBox\">" +
                "                        <button class=\"btn\" type=\"button\" onclick=\"changeRecord()\">积分记录</button>" +
                "                        <button class=\"btn\" type=\"button\" onclick=\"returnCashRecords()\">返现记录</button>" +
                "                    </div>" +
                "                </div>" +
                "            </div>" +
                "            <div>" +
                "                <div>" +
                "                    <span>当前积分：</span>" +
                "                    <span id=\"jfbalance\">" + data.jfbalancea + "</span>" +
                "                </div>" +
                "                <div>" +
                "                    <span>可抵扣返现金额：</span>" +
                "                    <span id=\"jfbalances\">" + data.jfbalance + "</span>" +
                "                </div>" +
                "            </div>" +
                "        </div>" +
                "    </div>" +
                "    <div id=\"memberBoxs\">" +
                "        <div style=\"margin-right: 10px;\">" +
                "            <div class=\"memberTitle\">" +
                "                <div>种植牙俱乐部</div>" +
                "                <div>" +
                "                    <div class=\"btnBox\">" +
                "                        <button class=\"btn\" type=\"button\" onclick=\"orthodonticsTransactionRecord()\">交易记录</button>" +
                "                    </div>" +
                "                </div>" +
                "            </div>" +
                "            <div>" +
                "                <span>种植牙俱乐部会费：</span>" +
                "                <span id=\"orthodonticsBalance\">" + data.orthodonticsMoney + "</span>" +
                "            </div>" +
                "        </div>" +
                "    </div>" +
                "</div>"
            $("#member").html(html);
        }
    });
}

//跳转
function tabJump(tabId) {
    $("#navBox li:eq(" + tabId + ") a").tab('show');
}

function addsf() {
    var index = layer.open({
        type: 2,
        title: '&nbsp',
        area: ['40%', '40%'],
        fix: true,
        maxmin: true,
        content: Feng.ctxPath + '/tcRevisit/to_addsf/'
    });
    this.layerIndex = index;
}

function addjg() {
    var index = layer.open({
        type: 2,
        title: '&nbsp',
        area: ['40%', '40%'],
        fix: true,
        maxmin: true,
        content: Feng.ctxPath + '/tcRevisit/to_addjg/'
    });
    this.layerIndex = index;
}